This can be done in Global.asax within Application_Error method.
Reference: http://msdn.microsoft.com/en-us/library/24395wz3.aspx
void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex.GetType() == typeof(HttpUnhandledException))
{
if (ex.Message.Contains("NoCatch") ||
ex.Message.Contains("maxUrlLength") ||
ex.Message.Contains("File does not exist."))
return;
Response.Write("~/Error.aspx");
}
Server.ClearError();
}
Reference: http://msdn.microsoft.com/en-us/library/24395wz3.aspx
No comments:
Post a Comment