更新时间:2022-11-26 10:05:15
您可以解决FileNotFoundException吗?如果不应发生异常,则应解决问题而不是抑制问题.要处理已知的异常,可以使用以下代码.
Cant you resolve the FileNotFoundException instead? If the exception should not occur then rather resolve the issue than suppressing it. To handle a known exception you can use the following code.
if(Server.GetLastError().GetBaseException() is System.Web.HttpException)
{
//You could check whether the
//Server.GetLastError().GetBaseException().Message contains the appropriate message
Debug.WriteLine("Suppressed FileNotFoundException");
}else
//Log an unhandled exception