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
            }
        }
 partial void UpdateLogEntry(LogEntry instance);
 partial void DeleteLogEntry(LogEntry instance);
 partial void InsertLogEntry(LogEntry instance);