Question

I want to allow users on the website to queue a report (enter the request in a sql table). The queue will be processed by a windows app that will read the queue from the sql server, run the reports, and update the reportcomplete field in the record. I need to be able to post a message saying something similar to "Generating report" and then alert the user when the report is available. I have toyed with SQLDependency and I can get the onchange event to fire, but of course I can't get back to the page that has already loaded in the browser. Pretty much out of ideas on how to accomplish this, and I'm thinking SQLDependency might be the wrong avenue. Any ideas?

Was it helpful?

Solution

HTTP cannot connect back to the client. The only solution is to for the client to poll, usually via a long tail (eg. Comet Ajax) request. So the original page request returns, a script starts on the result page and posts a background request that enters the ASP.Net code and blocks on an event. The SQLDependency notifies the event, so the long tail requests re-activates and returns the response to the agent, which now completes the Ajax call and can update the page. At least this is the 10000 ft. view. This will work, but won't scale (primarily because of the resources tied up by the Ajax request, the blocked ASP.Net processing thread). More scalable approaches exists, but are significantly more complex.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top