protected void Application_Error() { try { Exception lastError = Server.GetLastError(); if (!HttpContext.Current.IsDebuggingEnabled) { StringBuilder stringBuilder = new StringBuilder(GenUtil.GetExceptionStringForReporting(lastError)); Server.ClearError(); CommunicationServiceProvider.SendAdminNotification( new System.Net.Mail.MailAddress("*****@*****.**", "Craveats Notification"), "An application error occurred.", stringBuilder.ToString() ); } } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e); } }