I'm implementing the Enterprise Library Exception Handling Application Block in an ASP.NET application that I am building. I'm planning to handle uncaught application exceptions by placing the following code in my Global.asax.cs:
protected void Application_Error()
{
Exception error = Server.GetLastError();
Exception errorToThrow;
if (ExceptionPolicy.HandleException(error, "Application Error", out errorToThrow))
{
if (errorToThrow != null)
throw errorToThrow;
}
else
Server.ClearError();
}
I believe this will work to handle various post-handling actions of the policy (None, NotifyRethrow, ThrowNewException) but I want to know if anyone sees significant problems with this implementation.