Can you set a timeout for a request using
Net.WebClient()
I know that its possible with the WebRequest, however Id like to use the WebClient.
EDIT: I created a new Class called WbClnt containing this code:
Imports System.Net
Public Class WbClnt
Inherits WebClient
Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
Dim w As WebRequest = MyBase.GetWebRequest(uri)
w.Timeout = 5000
Return w
End Function
End Class
However, I cant call this function from my main form using WbClnt.GetWebRequest, probably because its protected.
WebClientand overrideGetWebRequest. What have you tried so far?WebClientin your new class. Now you can use your new class anywhere you would have used theWebClientor need it.