Sunday, July 11, 2010

A problem with "The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF"

Something changed on one of the web services I was using - suddenly one of my requests was failing with a WebException - 

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF


To fix this I had to add this to my web.config/app.config:

<system.net>
    <settings>
      <httpWebRequest useUnsafeHeaderParsing="true" />
    </settings>
</system.net>

Simples ;)