ASP.net WebRequest Exception "System.Net.WebException: The server committed a protocol violation"
Posted
by Billy
on Stack Overflow
See other posts from Stack Overflow
or by Billy
Published on 2010-03-17T07:56:19Z
Indexed on
2010/03/17
8:01 UTC
Read the original article
Hit count: 677
ASP.NET
I call WebRequest.GetResponse() and encounter the error:
The server committed a protocol violation. Section=ResponseStatusLine
I google this error and add the following lines in web.config:
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>
However, it doesn't work.
Here is my ASP.net code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "HEAD";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
......
}
© Stack Overflow or respective owner