Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6092367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:26:03+00:00 2026-05-23T12:26:03+00:00

I’m not seeing the real error in my custom error page when using an

  • 0

I’m not seeing the real error in my custom error page when using an UpdatePanel. In my Global.asax I have the following code:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

    'Get the exception
    Dim lastError = Server.GetLastError()
    If lastError IsNot Nothing Then
        Dim ex As Exception = lastError.GetBaseException()
        If ex IsNot Nothing Then
            'Log the error
            If Log.IsErrorEnabled Then
                log4net.ThreadContext.Properties("method") = ex.TargetSite.Name
                log4net.ThreadContext.Properties("userId") = User.Current.UserName
                Log.Error(ex.Message, ex)
            End If
        End If
    End If

End Sub

If I review the log or set a breakpoint I can see that I’m getting a timeout issue. Then I have the following code to send the user to the error page and display the error:

<script language="javascript" type="text/javascript">
    function EndRequestHandler(sender, args) {
        if (args.get_error() != undefined) {
            // Let the framework know that the error is handled,
            //  so it doesn't throw the JavaScript alert.
            args.set_errorHandled(true);

            var errorMessage = args.get_error().message.replace(/</gi, "&lt;").replace(/>/gi, "&gt;");

            // If there is, show the custom error.
            window.location = _root + 'ShowError.aspx?error=' + encodeURI(errorMessage)
        }
    }
</script>

But the error I’m getting from args.get_error() is this instead:

Sys.WebForms.PageRequestManagerServerErrorException:
An unknown error occurred while
processing the request on the server.
The status code returned from the
server was: 500

What do I have to do to get the timeout error to the error page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:26:04+00:00Added an answer on May 23, 2026 at 12:26 pm

    I finally found it here: http://msdn.microsoft.com/en-us/library/bb398934.aspx

    Although their example wouldn’t compile and didn’t give me exactly what I needed it got me in the right direction. I was able to control the message that gets put in the Async exception using this code:

    Protected Sub ScriptManager1_AsyncPostBackError(ByVal sender As Object, ByVal e As System.Web.UI.AsyncPostBackErrorEventArgs)
        If e.Exception.Data("ExtraInfo") IsNot Nothing Then
            ScriptManager1.AsyncPostBackErrorMessage = _
               e.Exception.Message & _
               e.Exception.Data("ExtraInfo").ToString()
        Else
            ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message
        End If
    End Sub
    

    I also had to remove the defaultRedirect in the web.config and only conditionally redirect if it was not an async call. I did that by changing my Global.asax to this:

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    
        'Get the exception
        Dim lastError = Server.GetLastError()
        If lastError IsNot Nothing Then
            Dim ex As Exception = lastError.GetBaseException()
            If ex IsNot Nothing Then
                'Log the error
                If Log.IsErrorEnabled Then
                    log4net.ThreadContext.Properties("method") = ex.TargetSite.Name
                    log4net.ThreadContext.Properties("userId") = User.Current.DomainName
                    Log.Error(ex.Message, ex)
                End If
                If Not IsAsyncPostBackRequest(Request) Then
                    Server.Transfer("~/ShowError.aspx")
                End If
            End If
        End If
    
    End Sub
    
    Public Function IsAsyncPostBackRequest(request As HttpRequest) As Boolean
        Dim values = request.Headers.GetValues("X-MicrosoftAjax")
        If values IsNot Nothing Then
            For Each value In values
                Dim parts = value.Split(","c)
                For Each part In parts
                    If part.Trim() = "Delta=true" Then
                        Return True
                    End If
                Next
            Next
        End If
        Return False
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.