R
Ron Weldy
I'm trying to get asp.net errors to write a entry in the server Application
log and have created an global.asax file and placed it in the root folder
where my web files reside but when I trigger an server error in some code I
do not get a log entry. The file contents are below. Any ideas why it does
not work?
<%@ Import Namespace="System.Diagnostics" %>
<script language="C#" runat="server">
void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "Error Caught in Application_Error event\n" +
"Error in: " + Request.Url.ToString() +
"\nError Message:" + objErr.Message.ToString()+
"\nStack Trace:" + objErr.StackTrace.ToString();
EventLog log = new EventLog();
log.Source = "myApplication";
log.WriteEntry(err, EventLogEntryType.Error);
}
</script>
log and have created an global.asax file and placed it in the root folder
where my web files reside but when I trigger an server error in some code I
do not get a log entry. The file contents are below. Any ideas why it does
not work?
<%@ Import Namespace="System.Diagnostics" %>
<script language="C#" runat="server">
void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "Error Caught in Application_Error event\n" +
"Error in: " + Request.Url.ToString() +
"\nError Message:" + objErr.Message.ToString()+
"\nStack Trace:" + objErr.StackTrace.ToString();
EventLog log = new EventLog();
log.Source = "myApplication";
log.WriteEntry(err, EventLogEntryType.Error);
}
</script>