Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

sometimes my ISP dropps the connection. my program creates a stream of a URL and reports back. I would like it to report seomthing else if it was unable to reach the website.

 

stream = New IO.StreamReader(wc.OpenRead(URL)

 

what should I add?

Posted

My guess is that your wc is the Webclient..

 

This is c#,

 

try

{

stream = New IO.StreamReader(wc.OpenRead(URL)

}

catch( Exception )

{

MessageBox.Show("You lost your connection");

}

 

Obviously you don't need to use the messagebox, but can do whatever you wish to do.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...