Webrequest TimeOut

nodroghcsog

Newcomer
Joined
Jun 19, 2004
Messages
1
Location
On my street
The code below works fine. However I would like to be able to stop the whole process if it is taking too much time say after 30 seconds if the transfer has not completed then abort the whole thing and go get the next URL. I have tried placing a timer handler into the mix but it did seem to work as I wanted. If anyone has a suggestion, I'm all ears & eyes.

Thanks

WebRequest = WebRequest.Create(URL)
WebRequest.Timeout() = RunInfo.ConnectTimeout
WebResponse = WebRequest.GetResponse
InputReceive = WebResponse.GetResponseStream
Encoding = System.Text.Encoding.GetEncoding("utf-8")
StreamRead = New System.IO.StreamReader(InputReceive, Encoding)
HTML = StreamRead.ReadToEnd()
If (Not WebResponse Is Nothing) Then
WebResponse.Close()
End If
 
Back
Top