请给我一些使用httpWebRequest的请求html页面的代码段 [英] Please give me some snippet code of request html pages using httpWebRequest
问题描述
我要请求此页面: http://www1.97down.info/qb/file. php/LV0OASV.html [ ^ ]
但总是会出错:
服务器提交了违反协议的协议. Section = ResponseStatusLine
这是我的代码:
I want to request this page: http://www1.97down.info/qb/file.php/LV0OASV.html[^]
But always get error:
The server committed a protocol violation. Section=ResponseStatusLine
Here''s my code:
HttpWebRequest request = WebRequest.Create("http://www1.97down.info/qb/file.php/LV0OASV.html") as HttpWebRequest;
request.Method = "GET";
request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; BOIE9;ENUS)";
request.ProtocolVersion = System.Net.HttpVersion.Version11;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
任何帮助将不胜感激
这是请求标头:
关键值
请求GET http://www1.wkdown.info/fs3/file.php/LV1WQZX.html HTTP/1.1
接受text/html,application/xhtml + xml,*/*
接受语言en-US
用户代理Mozilla/5.0(兼容; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; BOIE9; ENUS)
接受编码gzip,放气
代理连接保持活动
主持人www1.wkdown.info
实用程序无缓存
Cookie CNZZDATA2293212 = cnzz_eid = 74759829-1345940568-& ntime = 1346209496& cnzz_a = 0& retime = 1346209496931& sin =< ime = 1346209496931& rtime = 2
Any help would be appreciated
This is the request headers:
Key Value
Request GET http://www1.wkdown.info/fs3/file.php/LV1WQZX.html HTTP/1.1
Accept text/html, application/xhtml+xml, */*
Accept-Language en-US
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; BOIE9;ENUS)
Accept-Encoding gzip, deflate
Proxy-Connection Keep-Alive
Host www1.wkdown.info
Pragma no-cache
Cookie CNZZDATA2293212=cnzz_eid=74759829-1345940568-&ntime=1346209496&cnzz_a=0&retime=1346209496931&sin=<ime=1346209496931&rtime=2
推荐答案
查看本文:如何使用HttpWebRequest和HttpWebResponse在.NET [ ^ ]
附加参考资料:
Wiki:HttpWebRequest [ MSDN:HttpWebRequest类 [
Have a look at this article: How to use HttpWebRequest and HttpWebResponse in .NET[^]
Additional references:
Wiki: HttpWebRequest[^]
MSDN: HttpWebRequest Class[^]
这篇关于请给我一些使用httpWebRequest的请求html页面的代码段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!