获取不到Cookie呀。这样写对吗???
[C#] 纯文本查看 复制代码 //创建Httphelper对象
HttpHelper http = new HttpHelper();
//创建Httphelper参数对象
HttpItem item = new HttpItem()
{
URL = "https://www.dygod.net/e/search/index.php",//URL 必需项
Method = "post",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
Allowautoredirect = true,//默认为False就是不根据重定向自动跳转
Postdata = "show=title&tempid=1&keyboard=%BE%D1%BB%F7&Submit=%C1%A2%BC%B4%CB%D1%CB%F7",//Post要发送的数据
ResultCookieType = ResultCookieType.String //默认值可以不写
};
//请求的返回值对象
HttpResult result = http.GetHtml(item);
//获取请求的Cookie
string cookie = result.Cookie;
//获取302跳转URl
string redirectUrl = result.RedirectUrl;
item = new HttpItem()
{
URL = redirectUrl,//URL 必需项
Method = "get",//URL 可选项 默认为Get
ContentType = "text/html",//返回类型 可选项有默认值
Cookie = cookie
};
//请求的返回值对象
result = http.GetHtml(item);
//获取请请求的Html
string html = result.Html;
//获取请求的Cookie
cookie = result.Cookie; |