HttpWebRequest.GetResponse() gives "HTTP protocol violation" error after .net frameworks service packs

This blog is valid for users of .Net frameworks 1.0 SP3 and .Net frameworks 1.1 SP1

The error is really because server is sending response with bad header format, which violates the http protocol specifications. These changes had been made to disallow bad headers. Bad http header could cause security vulnerability based on response-splitting and other attacks based on misinterpreting HTTP streams. 

However if your application still need to deal with such responses, you could roll back to old bahavior of relaxed header parsing. You need to use following app.config file.

<httpWebRequest useUnsafeHeaderParsing="true"/>

This posting is provided "AS IS" with no warranties, and confers no rights