|
楼主 |
发表于 2013-11-8 09:46:34
|
显示全部楼层
[code=csharp] HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.lianlian.com/",//URL这里都是测试 必需项
Encoding = Encoding.UTF8 ,// "utf-8",//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
Method = "post",//URL 可选项 默认为Get
Postdata = "userName=" + this.txtUserName.Text.Trim() + "&password=" + this.txtPwd.Text.Trim() + "&checkCode=" + this.txtCode.Text.Trim() + "&login=%E7%99%BB+%E5%BD%95",
Cookie = NewCookies,
// Allowautoredirect = true ,
ContentType = "application/x-www-form-urlencoded"//返回类型 可选项有默认值
};
item.Header.Add("Accept-Encoding", "gzip,deflate");
item.Header.Add("Accept-Language", "zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3");
item.Header.Add("Connection", "keep-alive");
item.Header.Add("Cookie", NewCookies);
item.Header.Add("Host", "www.lianlian.com");
item.Header.Add("Referer", " http://www.lianlian.com/");[/code]设置了Header 但是返回的是:此标头必须使用适当的属性进行修改。
参数名: name。不知道是Header 哪里设置错误了
|
|