customerrors page that errored and error?

Discussion in 'ASP .Net' started by jobs, Nov 15, 2007.

  1. jobs

    jobs Guest

    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.
    jobs, Nov 15, 2007
    #1
    1. Advertising

  2. "jobs" <> wrote in message
    news:...
    [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.


    --
    Robert Dunlop
    ----------------
    http://www.directxzone.org
    http://rdunlop.spaces.live.com/
    Microsoft DirectX MVP 1998-2006
    Robert Dunlop, Nov 15, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SMG

    CustomErrors Trapping in a Page

    SMG, Apr 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    324
    Scott Allen
    Apr 9, 2005
  2. SMG
    Replies:
    6
    Views:
    620
    MattC
    Apr 15, 2005
  3. Replies:
    4
    Views:
    3,181
  4. Les Caudle
    Replies:
    0
    Views:
    491
    Les Caudle
    Oct 31, 2006
  5. wardy
    Replies:
    0
    Views:
    349
    wardy
    Mar 20, 2007
Loading...

Share This Page