I have my DotNet 2.0 web applications configured to send me email messages whenever errors happen. This wasn't too hard to do: I just added some code to the application_error event of global.asax. Usually, it works quite well and often I have a problem resolved before the user has time to alert me.
Recently, however, I've been getting a slew of puzzling errors. The message is: "Files does not exist" and it occurs in System.Web.StaticFileHandler.ProcessRequestInternal.
What was puzzling about this error is that it doesn't tell me which file is missing. I looked, and as near as I could tell everything was working fine. Yet my error logging continued to spew out these errors by the dozens.
After a little bit of research I was able to resolve the issue. It turns out that the request object as a "rawurl" property that returns the entire url being requested. I modified my error logging code to include the contents of this property and was able to determine that the icon file for the web page was missing. I copied it into its proper location and the stream of errors ceased.
Problem solved!
Here is the code that I use to log the errors, modified to include the rawurl property.
Recently, however, I've been getting a slew of puzzling errors. The message is: "Files does not exist" and it occurs in System.Web.StaticFileHandler.ProcessRequestInternal.
What was puzzling about this error is that it doesn't tell me which file is missing. I looked, and as near as I could tell everything was working fine. Yet my error logging continued to spew out these errors by the dozens.
After a little bit of research I was able to resolve the issue. It turns out that the request object as a "rawurl" property that returns the entire url being requested. I modified my error logging code to include the contents of this property and was able to determine that the icon file for the web page was missing. I copied it into its proper location and the stream of errors ceased.
Problem solved!
Here is the code that I use to log the errors, modified to include the rawurl property.
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
Dim oEX As Exception = Server.GetLastError.GetBaseException
Dim oMessage As New JMail.Message
oMessage.RecipientAddressList = "wse@jlion.com"
oMessage.SenderEmail = "wse@jlion.com"
oMessage.SenderName = "ReportingErrors"
Dim sMessage As String = "The following error has occurred: " & vbCrLf & oEX.Message & vbCrLf & oEX.StackTrace
Try
sMessage = HttpContext.Current.Request.PhysicalApplicationPath & vbCrLf & _
HttpContext.Current.Request.RawUrl & vbCrLf & _
sMessage
Catch oex3 As Exception
'---Don't do anything
End Try
oMessage.Message = sMessage
Dim sSubject As String = "Error in Reporting Web Site"
Try
sSubject = sSubject & ": " & HttpContext.Current.Server.MachineName
Try
sSubject = sSubject & " User: " & Session("UserID")
Catch oEx3 As Exception
'---Don't do anything
End Try
Catch oEx2 As Exception
'---Don't do anything
End Try
oMessage.Subject = sSubject
Dim oSender As New JMail.SendEmail
oSender.SendThisMessage(oMessage)
End Sub
0 Comments:
Post a Comment
<< Home