Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: WebClient - The underlying connection was closed


Message #1 by "Jenita" <jenita.a@n...> on Wed, 28 Aug 2002 14:51:20
Hi,

I'm trying to post a XML string to an URI using webclient.  It throws up 
the following error 
"Exception Details: System.Net.WebException: The underlying connection was 
closed: An unexpected error occurred on a receive."

The code I'm using is 
******
Dim web As New System.Net.WebClient()
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes(strRequestXML)
Dim res As Byte() = web.UploadData(strXMLServerName, "POST", d)

strResponseXML = System.Text.Encoding.ASCII.GetString(res)
*******

Can anyone tell me what is wrong in this code?  Or what is the 
prerequisite to use webclient, if any?  The same XML is successfully 
returning response when I use "MSXML2.ServerXMLHTTP40()" to post the 
request.

This is really bugging me and I have been hunting for a solution or 
atleast a clue on the web for the past 3 days.

Thanks in advance.

-Jenita

  Return to Index