获取网页内容
实在是不行了。搞了半天。一直是报
服务器提交了协议冲突.section=responsestatusline
我把链接发出来。哪位帮我弄下。。谢谢各位了
http://jsq2f.p2sp.baidu.com/queryfid?type=str&url=qvod://109856997|65521589D5BFEADB0702F5E6A86D445DFBD50DE3|%e7%81%ab%e5%bd%b1%e5%bf%8d%e8%80%85473.rmvb|
真心感谢。。。。。。。
------解决方案-------------------- WebClient client = new WebClient();
client.Credentials = CredentialCache.DefaultCredentials;
resStream = client.OpenRead(pageUrl);
sr = new StreamReader(resStream, System.Text.Encoding.UTF8);
strHtml = sr.ReadToEnd();
resStream.Close();
sr.Close();
这样就可以抓到了
------解决方案--------------------WinForm下的app.config文件中添加:
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
完整 app.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>
------解决方案--------------------
C#获取网页源代码的5种方法