有时 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) + "/");
有人能帮我吗?