samsmithnz
Senior Contributor
This is driving me up the wall. I just can't get a generic errorhandler to work. I've tryed every method. This is probably the easiest one for me.
Every function I have has an errorhandler like this:
Then in the Global.asax file I have:
Then in my Error.aspx file I have:
BUT it doesn't work, one of two things happens...
1. The error occurs on the page that it occurs and writes the standard vs.net error message out the screen.
2. The error handler actually manages to redirect to the error.aspx file, but I get a Object not initalised error while checking for the last error (Server.GetLastError = Nothing).
Why won't this work for me
Every function I have has an errorhandler like this:
Code:
Catch ex As Exception
Throw ex
End Try
Then in the Global.asax file I have:
Code:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("Error.aspx", False)
End Sub
Then in my Error.aspx file I have:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblError.Text = Server.GetLastError.ToString
End Sub
BUT it doesn't work, one of two things happens...
1. The error occurs on the page that it occurs and writes the standard vs.net error message out the screen.
2. The error handler actually manages to redirect to the error.aspx file, but I get a Object not initalised error while checking for the last error (Server.GetLastError = Nothing).
Why won't this work for me