System.Net.WebException: The underlying connection was closed: The server committed an HTTP protocol

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I have the following code:

Dim data As New System.Collections.Specialized.NameValueCollection

data.Add("SWEExtSource", "XXXProductHttp")
data.Add("SWEExtCmd", "Execute")
data.Add("UserName", "uname")
data.Add("Password", "password")

Dim wc As New System.Net.WebClient
Dim responseArray As Byte()
Dim serverURL As String = "http://myserver/eai_enu/start.swe"
responseArray = wc.UploadValues(serverURL, "POST", data)
results = System.Text.Encoding.ASCII.GetString(responseArray)

It works great on most of our servers, but on one of them I get the
following error:

System.Net.WebException: The underlying connection was closed: The
server committed an HTTP protocol violation.

The ironic thing is that the data actually posts to the server, so it's
the return message that is causing the error. This is a windows
service.

Anyone run into this?

Thanks,
Jeff
 
Back
Top