【发布时间】:2013-02-07 17:12:57
【问题描述】:
aspx.cs 中未处理的错误代码将被 global.asax 中的 Application_Error 处理程序捕获。
我在 Application_Error 处理程序中编写了一些代码来记录在 aspx.cs 中发生的此类未处理的错误
但是如果日志本身的代码也失败并产生了异常。(可能是由于I/O或文件系统问题)
我应该抛出这样的异常吗?
如果我把它扔掉,哪个事件应该收到这样的异常?
或者我是否写“抛出”语法没有区别?
代码示例如下
protected void Application_Error(object sender, EventArgs e)
{
try
{
// my codes to log exception to Database System here....
}
catch(Exception)
{
throw; //Should I write "throw" syntax here ?
}
}
【问题讨论】:
标签: c# asp.net exception-handling global-asax