Menu Chiudi

The server committed a protocol violation…

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

Se lanciando un’applicazione in cui si usa il WebClient com per esempio

Stringa = "http://ipaddres/etc"

Dim myClient As New WebClient
myClient.Credentials = New NetworkCredential(UserName, Password)
Dim value As String
value = myClient.DownloadString(ConfigStringa)

myClient.Dispose()

e compare l’errore

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

in App.config inserire le seguenti righe:

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

Pubblicato il Sviluppo sw