By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,014 Members | 1,012 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,014 IT Pros & Developers. It's quick & easy.

WebClient()

P: n/a
Hello,
I am using System.Net.WebClient() to download a web page. This works
fine in itself, BUT... if there is no response from the web site or if
my network is down, it NEVER times out trying to get the page. So, I
guess I am asking if there is a way to set a timeout for the
WebClient?

I have looked around for this but my search is coming up empty for the
most part. If there is no way to set a timeout for the WebClient(),
then is there something else I can use to download the web page into
memory and work with it from there? Currently, I use:

Dim myWebClient As New WebClient()
Dim theIP As String
theIP = myWebClient.DownloadString("http://www.foo.com/")

I then pass the resulting downloaded string to a parser function and
work with it from there.

Is there another method for doing this same thing, but which includes
an option to set a timeout?

Many thanks in advance!

Ryan
May 13 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.