使用WebClient进行数据采集(Internet上的aspx页),是WinForm程序,经常会遇到这样的异常:服务器提交协议冲突 Section=ResponseStatusLine网上有说法是CLR,于是我在WebClient请求之前加上了这个,但无效
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");求正解
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");求正解
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing= "true " />
</settings>
</system.net>
</configuration>
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;MyIE2; Alexa Toolbar; mxie; .NET CLR 1.1.4322");