I have given up hope. I was doing a simple xmlhttppost in ASP and it was working as smooth as butter. Now I am trying to do the same in dotnet and it is creating all the problems. I am trying to use the WebRequest class. And I keep getting a standard error - "The underlying connection was closed: The remote name could not be resolved. "
I have tried using byte arrays, xml and what not, but the error remains - "The underlying connection was closed: The remote name could not be resolved. "
Does this have anything to do with the URL to which I am posting? If it is a java servlet do I have to do something extra? The code i am doing is below. And I am nearly giving up on that. Any response will be greatly appreciated.
Dim xmlRequest As System.Net.WebRequest
Dim xmlResponse As System.Net.HttpWebResponse
Dim strm As System.IO.Stream
Dim strmReader As System.IO.StreamReader
Dim xmlDoc As System.Xml.XmlDocument
xmlRequest = System.Net.HttpWebRequest.Create("url here")
xmlRequest.ContentType = "text/xml"
'xmlRequest.Accept = "text/xml"
xmlRequest.Method = "POST"
xmlDoc = New System.Xml.XmlDocument
xmlDoc.Load(Server.MapPath("xml path here"))
'Dim byteArray As Byte() = Encoding.ASCII.GetBytes(xmlDoc.InnerXml)
'xmlRequest.ContentLength = byteArray.Length
strm = xmlRequest.GetRequestStream()
'strm.Write(byteArray, 0, xmlDoc.InnerXml.Length)
xmlDoc.Save(strm)
strm.Close()
xmlResponse = xmlRequest.GetResponse()
strm = xmlResponse.GetResponseStream()
strmReader = New System.IO.StreamReader(strm)
Response.Write(strmReader.ReadToEnd())
Thanks in advance.