I have created an error page to show a general message for all unhandled exceptions.
This is the code in Global.asax
HttpContext ctx = HttpContext.Curren
Replace Response.Redirect("~/Error.aspx");
with:
// You've handled the error, so clear it. Leaving the server in an error state can cause unintended side effects as the server continues its attempts to handle the error.
Server.ClearError();
// Possible that a partially rendered page has already been written to response buffer before encountering error, so clear it.
Response.Clear();
// Finally redirect, transfer, or render a error view
Response.Redirect("~/Error.aspx");