customerrors page that errored and error?

J

jobs

Hello.

I've got a customerrors section in my web.config that redirects all
errors to an ErrorPage.aspx

<customErrors defaultRedirect="~/ErrorPage.aspx">
<error statusCode="403" redirect="~/NoAccess.htm"/>
<error statusCode="404" redirect="~/FileNotFound.htm"/>
</customErrors>
</system.web>

Is there any way for me to get the page that errored and the error
from the ErrorPage.aspx?

I've tried Request.ServerVariables("HTTP_REFERRER") and
Server.GetLastError().InnerException to no avail.Both are either null
or blank everytime.


Dim ErrorDetail As String = ""
If Not Server.GetLastError Is Nothing Then
ErrorDetail =
Server.GetLastError().InnerException.ToString
End If
Dim page As String =
Request.ServerVariables("HTTP_REFERRER")


Thanks for any help or information.
 
R

Robert Dunlop

[clip]
Is there any way for me to get the page that errored and the error
from the ErrorPage.aspx?

I've tried Request.ServerVariables("HTTP_REFERRER") and
Server.GetLastError().InnerException to no avail.Both are either null
or blank everytime.


Dim ErrorDetail As String = ""
If Not Server.GetLastError Is Nothing Then
ErrorDetail =
Server.GetLastError().InnerException.ToString
End If
Dim page As String =
Request.ServerVariables("HTTP_REFERRER")
[clip]

I use HttpContext.Current.Request.RawUrl to get the full URL of the request
that caused the error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top