G
Guest
Hi all, I've been trying to get HttpWebResponse to work, but whenever I try I
get "The operation has timed-out". I'm simply trying to send an HTTP request
querystring to a remote website and read back the single string it returns
(OK/Not-Ok)! It seems such a simple thing to do, but I've been on this for
hours now!
Here's the code I'm trying:
Dim myRequest As HttpWebRequest
Dim myResponse As HttpWebResponse
Dim sr As StreamReader
myRequest = CType(WebRequest.Create("http://www.microsoft.com"),
HttpWebRequest)
myRequest.ContentType = "application/x-www-form-urlencoded"
myResponse = CType(myRequest.GetResponse(), HttpWebResponse)
sr = New StreamReader(myResponse.GetResponseStream())
I've also tried an alternative which I found on the www.asp.net forum:
Dim objClient As New WebClient
Dim objStream As Stream = objClient.OpenRead("http://www.microsoft.com")
Dim objRead As New StreamReader(objStream)
Response.Write(Server.HtmlEncode(objRead.ReadToEnd))
And I get exactly the same results.
Any help would be gratefully received!!
Noggin
get "The operation has timed-out". I'm simply trying to send an HTTP request
querystring to a remote website and read back the single string it returns
(OK/Not-Ok)! It seems such a simple thing to do, but I've been on this for
hours now!
Here's the code I'm trying:
Dim myRequest As HttpWebRequest
Dim myResponse As HttpWebResponse
Dim sr As StreamReader
myRequest = CType(WebRequest.Create("http://www.microsoft.com"),
HttpWebRequest)
myRequest.ContentType = "application/x-www-form-urlencoded"
myResponse = CType(myRequest.GetResponse(), HttpWebResponse)
sr = New StreamReader(myResponse.GetResponseStream())
I've also tried an alternative which I found on the www.asp.net forum:
Dim objClient As New WebClient
Dim objStream As Stream = objClient.OpenRead("http://www.microsoft.com")
Dim objRead As New StreamReader(objStream)
Response.Write(Server.HtmlEncode(objRead.ReadToEnd))
And I get exactly the same results.
Any help would be gratefully received!!
Noggin