Our site has an admin page that allows administrators to kick off a process that copies a given template CMS page out to a couple hundred directories. I guess this process takes a few minutes to run so the page times out. So what I think we need it to do is have the submit button start the task, then have the page poll for results every X seconds until it completes.
I've been trying to figure out how to do this and have seen Phil Haack's popular "Dangers of Implementing Recurring Background Tasks in ASP.NET" post. While a decent argument could be made that an external application should perform this work and not the web server, in reality, it won't be used very often, a web interface will be desired by admins, and we already have a working version of the code, the browser just doesn't wait around long enough to report completion.
I came across HostingEnvironment.QueueBackgroundWorkItem and thought that might work, except it looks like the current HttpContext isn't available to it. I think this might interfere with the CMS API, but I was also planning to use the Session State for my flag to indicate when the task had completed.
I've seen pages, like travel websites, or the SSRS web interface, show a polling page while it does some long-running processing. I don't need anything fancy or intricate for this purpose, I just need to avoid the timeout. Am I on the wrong track with QueueBackgroundWorkItem? If not, how can I tell when the task has finished?