|
楼主 |
发表于 2015-9-13 09:55:37
|
显示全部楼层
又搞了了半天,没有验证码,简单的也搞不定了。我错在什么地方? 求助
//创建Httphelper对象
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "http://hk1.001lv.com/lvlogin/login.aspx",//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
ResultCookieType =ResultCookieType.CookieCollection,
//ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
//Cookie = "visid_incap_589295=Us2917dbTkimKVkIrnKnG29R7FUAAAAAQUIPAAAAAADOE0gn3XkxzZrR3YtSM4aW; visid_incap_593167=NnEI+sy8RPaShlWg9Ny1WFHL8FUAAAAAQUIPAAAAAADiWhQnaaEumvjfe0aZAjZI"
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
//获取请求的Cookie
string cookie = result.Cookie;
HttpItem loginItem = new HttpItem()
{
URL = "http://hk1.001lv.com/httphandle/UserHandler.ashx",//URL 必需项
Method = "post",//URL 可选项 默认为Get
Accept = "text/plain, */*; ",
Referer = "http://hk1.001lv.com/lvlogin/login.aspx",
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
ContentType = "application/x-www-form-urlencoded; charset=UTF-8",//返回类型 可选项有默认值
KeepAlive = true,
Postdata = "{" + "action: \"1\", type: \"1\", uname: \"potato2015\", pwd: \"112233abc\"" + " }",
Cookie = cookie,
ResultCookieType = ResultCookieType.CookieCollection,
CookieCollection = result.CookieCollection,
//ResultCookieType = ResultCookieType.CookieCollection,
//CookieCollection = imgResult.CookieCollection,
};
//请求的返回值对象
HttpResult loginResult = http.GetHtml(loginItem);
//获取请请求的Html
string loginHtml = loginResult.Html;
//获取请求的Cookie
string currentCookie = loginResult.Cookie; 这个地方一直为空,郁闷的很!!!
|
|