I'm writing a web-app in C#, where one of its functions involves a method which could take several hours to complete. At first I had the obvious issues with a browser timeout, so I implemented the function call in a thread - which then ran the long function, and which I stored in an object in the Session, and could query from a timer/update panel to show its progress in the browser window.
I actually thought it was pretty smart - but then I discovered that if the user shut down the browser, or even went to a new page, then my thread would be terminated - well, it simply vanished. Actually this also seemed to happen after many hours even if the browser simply stayed open where it was - I wonder if some asp.net process is resetting something somewhere?
Anyway, is there any way I can ensure my thread will stay running until completion? Do I need to actually spawn/fork/execute (don't know the correct terminology) a whole new program which will then run my long method?
View Complete Post