C HTMLagilitypack exception help
foreach (string mul in masterurlList)
{
HtmlWeb hwObject = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmldocObject = hwObject.Load(mul);
List<string> hrefTags = new List<string>();
try
{
hrefTags = ExtractAllAHrefTags(htmldocObject);
}
catch (Exception)
{ }
I already have an catch(exception) in my code but what happens in on HtmlAgilityPack.HtmlDocume开发者_JAVA百科nt htmldocObject = hwObject.Load(mul) i get WebException was unhandled. The remote name could not be resolved: 'www.eonline.com'
I can't get rid of the try and catch that i have, and if i expand my try area i lose all my strings. any help would be awesome! And i know my DNS is good
Expand the try area like this to keep your strings...
foreach (string mul in masterurlList)
{
List<string> hrefTags = new List<string>();
try
{
HtmlWeb hwObject = new HtmlWeb();
HtmlAgilityPack.HtmlDocument htmldocObject = hwObject.Load(mul);
hrefTags = ExtractAllAHrefTags(htmldocObject);
}
catch (Exception)
{ }
}
精彩评论