本帖最后由 geracain 于 2016-12-16 16:40 编辑
代码如下,web浏览器同期访问正常。是不是有什么参数不对?
[C#] 纯文本查看 复制代码 public static string LoginAsyn(string userName, string passWord, string pointString)
{
string postData = string.Format("loginUserDTO.user_name={0}&userDTO.password={1}&randCode={2}", userName, passWord, pointString);
HttpItem item = new HttpItem()
{
URL = "https://kyfw.12306.cn/otn/login/loginAysnSuggest",
Method = "POST",
Timeout = 100000,
ReadWriteTimeout = 30000,
IsToLower = false,
Cookie = cookie,
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",
Accept = "*/*",
ContentType = "application/x-www-form-urlencoded",
Host = "kyfw.12306.cn",
Referer = "https://kyfw.12306.cn/otn/login/init",
Allowautoredirect = true,
AutoRedirectCookie = true,
Postdata = postData,
ResultType = ResultType.String,
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
MessageBox.Show(html);
return html;
}
|