How do I update a webpage with the progress of a server-side task?

Posted by Jim B on Stack Overflow See other posts from Stack Overflow or by Jim B
Published on 2010-03-16T19:48:22Z Indexed on 2010/03/16 19:51 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

Hi everyone,

I'm working on a web project that takes the results from a survey type application, and runs them through a bunch of calculations to come up with some recommended suggestions for the user.

Now, this calculation might take a minute or so, so I'd like to be able to give the user some update on it's progress. Obviously, the quick and dirty solution would be to put up a message along the lines of "Please wait while we calculate your recommendations" with a spinning gear type graphic. (or whatever, you get the point..). Once the task completes, I'd redirect to the results page.

However, I'd like to do something a little more flashy. Maybe something along the lines of a progress bar, and even prompt the user with what's going on in the background. For example, give them a progress bar, with some text that says "Now processing suggestion 3 of 15; Multi-Vitamin"

Any suggestions on how I could set this up? One way I'm thinking of doing it is to write the progress of the calculation method to the HttpContext, and slap up an update panel and timer that would show/refresh this info. I've also checked out maybe building a web service/method, and then poll that at some interval.

Has anybody done something similar to this before? What worked for you?

Thanks again!

~Jim

© Stack Overflow or respective owner

Related posts about c#

Related posts about progressbar