I've got Page_Error emailing me the message and stack trace when a
server error is generated, but it doesn't always work. My Page_Error
code:
Sub Page_Error(ByVal src As Object, ByVal args As EventArgs) Handles
MyBase.Error
Dim e As System.Exception = Server.GetLastError()
Session("Erro")= "Error: " & e.Message.ToString() & "<p>Stack Trace: "
& e.StackTrace.ToString()
Context.ClearError()
End Sub
My web.config file redirects the user to a "nice" error page, which
emails me the Session("Erro") so I can investigate the problem. What
I can't understand is that sometimes Session("Erro") is blank - I saw
two emails come through with errors on the same page today, with one
full of useful info, and one completely empty. What might explain
this?
Thanks,
Erik