ASP.NET processing error
I am doing some research on how to globally handle errors in my ASP.NET application. I decided to use the web.config file with the following code:
<customErrors mode="On" defaultRedirect="errorpage.aspx">
</customErrors>
Here is my errorpage.aspx.vb code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ex As Exception = Server.GetLastError
End Sub
The problem I am facing Server.GetLastError
ends up being nothing. What do I need to do to have access to the latest information about the error? Since it's on the asp form page, I don't need to add HttpContext.Current.
to Server.GetLastError
, right?
thank
0
source to share
2 answers
You can catch global errors with global.asax .
The error page is loaded with a simple http redirect and unfortunately doesn't know what the last error is for a specific user.
+3
source to share