<%@ Application Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.Text" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Obtain the URL of the request
string url = Request.Path;
// Obtain the Exception object describing the error
Exception error = Server.GetLastError();
// Build the message --> [Error occurred. XXX at url]
StringBuilder text = new StringBuilder("Error occurred. ");
text.Append(error.Message);
text.Append(" at ");
text.Append(url);
// Write to the Event Log
EventLog log = new EventLog();
log.Source = "Core35 Log";
// log.WriteEntry(text.ToString(), EventLogEntryType.Error);
}
</script>
|