Handle Application Errors
In Application to avoid the handle Errors and maintain the Errors data use the following code....
FileName: Global.asax
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
try
{
string str = Server.MapPath("~/logs/") + MyTime.Now().ToString("MMddyyyyHHmmss.err") ;
Exception objErr = HttpContext.Current.Server.GetLastError().GetBaseException();
System.IO.File.AppendAllText(str, objErr.ToString());
//Response.Redirect("~/ErrorPage.html");
}
catch ( Exception ex)
{
}
}
In Application to avoid the handle Errors and maintain the Errors data use the following code....
FileName: Global.asax
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
try
{
string str = Server.MapPath("~/logs/") + MyTime.Now().ToString("MMddyyyyHHmmss.err") ;
Exception objErr = HttpContext.Current.Server.GetLastError().GetBaseException();
System.IO.File.AppendAllText(str, objErr.ToString());
//Response.Redirect("~/ErrorPage.html");
}
catch ( Exception ex)
{
}
}
Comments
Post a Comment