we ca capature exception or crashes that are generated
1-you have added try catch blocks and in catch block you can easily get the text of exception like
try
{
}
catch(Exception ex)
{
//insert exception in db or any log file (ex.tostring())
}
2-There are exception that are not handled through try catch block you can easily get those as well
on global_asax there is an event Application_Error you can use it for exception locking
void Application_Error(object sender, EventArgs e)
{
foreach (Exception ex in Context.AllErrors)
// insert in log or db file;
}
3.There is another way you store your Unhandled exception just add an event handler on global.asax
void Application_Start(object sender, EventArgs e)
{
AppDomain.CurrentDomain.UnhandledException +=newUnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// store to (e.ExceptionObject as Exception);
}
No comments:
Post a Comment