Created
February 14, 2011 04:43
-
-
Save friism/825494 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_Error(object sender, EventArgs e) | |
{ | |
try | |
{ | |
var exception = Server.GetLastError(); | |
var logEntry = new LogEntry | |
{ | |
Date = DateTime.Now, | |
Message = exception.Message, | |
StackTrace = exception.StackTrace, | |
}; | |
var datacontext = new LogDBDataContext(); | |
datacontext.LogEntries.InsertOnSubmit(logEntry); | |
datacontext.SubmitChanges(); | |
} | |
catch (Exception) | |
{ | |
// failed to record exception | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment