| re: Easiest way to get page name from error routine?
Try getting the stack trace from the inner exception.
Sample:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
Dim myError As Exception = Server.GetLastError
If Not myError.InnerException Is Nothing Then
Dim stackTrace As String =
myError.InnerException.StackTrace()
End If
Server.ClearError
End Sub
Tommy,
Bill Borg <anonymous@discussions.microsoft.com> wrote in message news:<0D952BC9-A241-42ED-8F5F-DA2A30E706A7@microsoft.com>...[color=blue]
> Hello all,
>
> When I jump to a generic error page, is there an easy way to know which page generated the error?
>
> I've got a catch-all error handler in Application_Error in[/color]
global.asax. From there, I want to format a query string, then pass
that to ErrorPage.aspx to display the formatted error. I can get
server.GetLastError and pass system.exception.message, but I'd also
like to pass the url of the offending page that raised the error, but
am not seeing how to easily get this. I know that on each page I
could store the url in session in case the error page needs it
sometime, but it seems like there's an easier way to just get the url
of the "caller" to the error page.[color=blue]
>
> Any thoughts are appreciated.
>
> Thanks,
>
> Bill Borg[/color] |