Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var item in urls)
- {
- try
- {
- string html = url.DownloadString(item);//(1) If exception is thrown here...
- Console.WriteLine("Start: " + item);//(2) ...this code won`t execute....
- }
- catch (WebException we)
- {
- Console.WriteLine("Invalid uri encountered");//... You can mark catching the exception...
- }
- //(3)... but program will continue from here
- //(and iterate through the next item of the "foreach" loop, if any are left)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement