What I have is a process on the server that runs and takes a lot of time. It essentially builds some data tables that are displayed on a page on post-back.
What I want is a way to log progress somewhere while the server process is running and report that on the page I am looking at before it is refreshed with the completed data.
Is this even possible? The best way I can think of to do this is to log progress to a file on the server and periodically read the file contents via Ajax/Javascript, but this seems like a kludge.
Maybe this is possible using multiple pages or threads. I’m not sure.
Any suggestions?
Edit:
The main goal is to show a progress bar of some sort on the web page to show the above mentioned progress.
Yes, but it’s not easy, or pretty.
Yep, pretty much. Other options are to use a database to store the info, or session, but any storage location that can be accessed somehow through an Ajax request would work. You’ll no doubt want to make a web service or similar to abstract away whatever storage method you use.
Here is an implementation of that general approach in a Microsoft example. It uses Session to store the current progress, and relied heavily on ASP-based constructs.
Another avenue entirely would be to set up a websocket between the client and the server which would allow you to push information from the server to the client. It would likely perform better (reduced network IO), although it may not be easier to set up. I don’t have any examples (or experience attempting) such a solution though.