Beispiel #1
0
 public static LoginResponseData Login(PreLoginResponseData data, string username, string password, string code, WebProxy proxy)
 {
     try
     {
         string userNameBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(HttpUtility.UrlEncode(username)));
         password = EncryptPassword(data, password);
         string     url  = "http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.18)&_=" + DateTime.Now.TimeStamp();
         PostHelper post = new PostHelper(url);
         post.Type    = PostTypeEnum.Post;
         post.Cookies = new CookieContainer();
         post.Cookies.SetCookies(new Uri("http://weibo.com"), data.cookies);
         post.Proxy     = proxy;
         post.PostItems = LoginData.Create(data, userNameBase64, password, code);
         string result       = post.Post();
         var    responseData = JsonConvert.DeserializeObject <LoginResponseData>(result);
         if (responseData != null)
         {
             responseData.cookies = PostHelper.GetAllCookies(post.Cookies);
             return(responseData);
         }
     }
     catch (Exception ex)
     { }
     return(null);
 }