467,130 Members | 1,263 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,130 developers. It's quick & easy.

Ajax.NET asynchronous call waits for first process to finish before executing second

Expert Mod 8TB
I have a peculiar problem...


I have a function that I don't want the user to execute more than once while they are waiting for it to process; therefore, I disable all of the controls on the page via some JavaScript before the request is sent. This function takes some time to execute because it has to communicate with hardware that is rather slow. This slowness combined with a little bit of lag sometimes results in a Sys.WebForms.PageRequestManager TimeoutException. Since I disable all of the controls during this processing, and because this exception prevents the server responding to the browser, my web page becomes unusable.

To fix this problem I ended up writing a JavaScript function that enables the "Exit" button on the page and displays a message informing the user that there was a problem when ever a Ajax Exception occurs...(this has been implemented in a function that is attached to the EndRequest event for those of you who are curious).

So now my user has a way to exit the page when something goes wrong.


Consider the following Scenario

1. The user clicks the button that triggers the slow function to execute.
When this happens a time out exception is thrown, my JavaScript catches the exception, enables the Exit button and displays an error message
2. The user clicks the exit button

When the user clicks the exit button, another time out exception is thrown.....

Debugging this problem I placed a break point after the slow function finishes executing and a break point in the PageLoad of the aspx page.

When I click the exit button in step 2, the PageLoad event does not occur until After the slow function (triggered in step 1) has finished executing.

Could someone please explain to me why the first function has to finish executing before the second request can be processed?

It makes no sense to me why we would be given the ability to preform asynchronous calls to the server if the server cannot handle more than one request from a web browser.

Thanks in advance,

Jul 25 '08 #1
  • viewed: 1281

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

48 posts views Thread by Steve - DND | last post: by
3 posts views Thread by Tony | last post: by
2 posts views Thread by dmagliola@gmail.com | last post: by
20 posts views Thread by Bryan A | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.