【发布时间】:2013-08-30 17:12:31
【问题描述】:
有时 htmlDocument.Load(url) 会给我这个异常:
Unhandled Exception: System.IO.IOException: Unable to read data from the transpo
rt connection: An existing connection was forcibly closed by the remote host. --
很遗憾,我无法捕捉到这个异常。
我发现异常如下:
try
{
page = web.Load(url + Convert.ToString(i + 1) + "/");
}
catch (ArgumentException ex)
{
//do something
}
当我运行程序时,异常仍然在写入的那一行停止程序:
page = web.Load(url + Convert.ToString(i + 1) + "/");
有人可以帮我吗?
【问题讨论】:
标签: c# exception error-handling try-catch dom