Hey Guys,
What i'm doing here is after i do an httpwebrequest i am looking to make sure we get a 200 ok before continuing, in the test code i have:
This is the part i can't figure out i get an error:
The command statusCode doesn't exist i even pasted the code from another website.
Any help would be appreciated :)
cheers guys
Graham
What i'm doing here is after i do an httpwebrequest i am looking to make sure we get a 200 ok before continuing, in the test code i have:
Code:
'// [GET] REQUEST
Dim GETRequest As HttpWebRequest = CType(WebRequest.Create(searchURL), HttpWebRequest)
'// ADDITIONAL INFORMATION
With GETRequest
.Method = "GET"
.Accept = "*/*"
.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
.KeepAlive = True
End With
'// THE RESPONSE
Dim GETResponse As WebResponse = GETRequest.GetResponse()
'// GET THE STREAM BACK FROM THE SERVER
Dim GETdataStream As Stream = GETResponse.GetResponseStream()
'// STREAMREADER
Dim GETreader As New StreamReader(GETdataStream)
'// READ THE CONTENTS
Dim GETresponseFromServer As String = GETreader.ReadToEnd()
MessageBox.Show(GETResponse.ToString)
'// RESPONSE 200 OK
If GETResponse. = HttpStatusCode.OK Then
'MessageBox.Show(ControlChars.Lf + ControlChars.NewLine + "Response Status Code is OK and StatusDescription is: {0}", GETResponse.StatusDescription)
End If
Code:
If GETResponse.statusCode = HttpStatusCode.OK Then
'MessageBox.Show(ControlChars.Lf + ControlChars.NewLine + "Response Status Code is OK and StatusDescription is: {0}", GETResponse.StatusDescription)
End If
Any help would be appreciated :)
cheers guys
Graham