B
Bob L.
Greetings,
I have the following function which does a simple HTTP POST and reads the
results. I had this working a couple of weeks ago, but I obviously made some
change that now causes any URL to return a timeout (the
HttpWebRequest.Timeout period expires). I've tested this on 3 different
machines with the same result. Can anyone spot the one thing that I keep
missing?
Many thanks,
Bob L.
Private Function GetResponse(ByVal sMyURL As String) As String
Dim oRequest As HttpWebRequest
Dim oWriter As StreamWriter
Dim oResponse As HttpWebResponse
Dim oReader As StreamReader
oRequest = WebRequest.Create(sMyURL)
oRequest.Method = "POST"
oRequest.ContentLength = sMyURL.Length
oRequest.ContentType = "application/x-www-form-urlencoded"
oWriter = New StreamWriter(oRequest.GetRequestStream())
oWriter.Write(sMyURL)
oResponse = oRequest.GetResponse() '***** Timeout occurs here
oReader = New StreamReader(oResponse.GetResponseStream())
GetResponse = oReader.ReadToEnd
oReader.Close()
oWriter.Close()
End Function
I have the following function which does a simple HTTP POST and reads the
results. I had this working a couple of weeks ago, but I obviously made some
change that now causes any URL to return a timeout (the
HttpWebRequest.Timeout period expires). I've tested this on 3 different
machines with the same result. Can anyone spot the one thing that I keep
missing?
Many thanks,
Bob L.
Private Function GetResponse(ByVal sMyURL As String) As String
Dim oRequest As HttpWebRequest
Dim oWriter As StreamWriter
Dim oResponse As HttpWebResponse
Dim oReader As StreamReader
oRequest = WebRequest.Create(sMyURL)
oRequest.Method = "POST"
oRequest.ContentLength = sMyURL.Length
oRequest.ContentType = "application/x-www-form-urlencoded"
oWriter = New StreamWriter(oRequest.GetRequestStream())
oWriter.Write(sMyURL)
oResponse = oRequest.GetResponse() '***** Timeout occurs here
oReader = New StreamReader(oResponse.GetResponseStream())
GetResponse = oReader.ReadToEnd
oReader.Close()
oWriter.Close()
End Function