I've been doing some research on how to globally handle errors in my ASP.NET application. I have settled on using 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 experiencing is Server.GetLastError
ends up being nothing. What do I have to do to be able to access the last error info? Since it is on an asp form page, I shouldn't have to prepend HttpContext.Current.
to the Server.GetLastError
, correct?
Thanks