Making a concurrent AJAX WCF Web Service request during an Async Postback
- by nekno
I want to provide status updates during a long-running task on an ASP.NET WebForms page with AJAX.
Is there a way to get the ScriptManager to execute and process a script for a web service request concurrently with an async postback?
I have a script on the page that makes a web service request. It runs on page load and periodically using setInterval(). It's running correctly before the async postback is initiated, but it stops running during the async postback, and doesn't run again until after the async postback completes.
I have an UpdatePanel with a button to trigger an async postback, which executes the long-running task. I also have an instance of an AJAX WCF Web service that is working correctly to fetch data and present it on the page but, like I said, it doesn't fetch and present the data until after the async postback completes.
During the async postback, the long-running task sends updates from the page to the web service.
The problem is that I can debug and step through the web service and see that the status updates are correctly set, but the updates aren't retrieved by the client script until the async postback completes.
It seems the Script Manager is busy executing the async postback, so it doesn't run my other JavaScript via setInterval() until the postback completes.
Is there a way to get the Script Manager, or otherwise, to run the script to fetch data from the WCF web service during the async postback?
I've tried various methods of using the PageRequestManager to run the script on the client-side BeginRequest event for the async postback, but it runs the script, then stops processing the code that should be running via setInterval() while the page request executes.