Thursday, 17 January 2013

Handling Application_Error in ASP.NET using app's global.asax

Write the following code in global.asax file 

protected void Application_Error(Object sender, EventArgs e)
{
    Exception ex = Server.GetLastError();
    if (ex is ThreadAbortException)
        return;
    Logger.Error(LoggerType.Global, ex, "Exception");
    Response.Redirect("unexpectederror.htm");
}
 
Click here for Reference Page

No comments:

Post a Comment