Due to how the Internet works, you will need to client-side script to query the server. The server always listens to the request from the client, but the clients do not always listen to the response from the server, so if the client did not initiate the request, it will not wait for a response.
Regarding how to do this, I used jQuery to access the ASP.Net web service in the past and was very pleased. If you go this route, ASP.net will automatically convert between JSON objects in .Net and vice versa, which is very convenient.
Here's a message showing you how to use jQuery to access a web service, and another one on how to set up a web service on a server.
In addition, you usually don’t want the web service to take a few minutes, as this may cause the server to have no problems with the stream. You might want to know about setting up a scheduled task to pre-compute this data or add indexes to the data source so that you can quickly view it. In any case, while you are using AJAX, your user web interaction will not be blocked (i.e., they will still be able to click on the links and interact with your site. If they move from the page, although the browser will close the connection when loading, and the user will start a new request and will wait all the time to get a response.)
Unfortunately, I don't know anything about the new library of .NET parallel tasks, but perhaps one of the options that you could fulfill, depending on what you are requesting, is to make several AJAX requests for different pieces of data. This will automatically make things parallel on the server side, giving you the added benefit of showing progress on the client side, as each of these requests returns independently. If this does not work, another popular template to notify the user of progress with long requests is to transfer data so often along with a “continuation token”. As long as the client code receives the continuation token, it knows that there is more data, and it passes that token back to the server with the following request. The server then uses this token to pick it up for the last time. That way, it might be something as simple as the RowID he stopped the last time.
source share