c# - Where to store progress information in ASP.Net web application -


i'm creating page uploaded text files , builds them multiple pdfs. exports excel. each row in file corresponds new pdf needs created.

anyway, once files uploaded want begin processing them, don't want user have stay on page, or still have session open. example close browser , come 10 minutes later, log in, , progress information 112/200 files processed or something. lot quicker though.

so 2 questions really, how can pass processing job (handler?thread?) continue run when page closed, , return job has started (so browser isn't stopped)? secondly, can store information when user comes page, can see current progress.

i realise can't use sessions, , since processing file second don't really want update db every second. there way can this? possible?

i solved using link provided astander above. create object in httpcontext.application store progress variables, , set method processing inside new thread.

// create new progress object batchprogress bs = new batchprogress(0); if(application["batchprogress"] != null) {     // should never happen     application["batchprogress"] = bs; } else {     application.add("batchprogress","bs"); }  //set new thread, run batch method processing. threadstart ts = new threadstart(runbatch); thread t = new thread(ts); t.start(); 

it returns after thread starts , can use jquery application["batchprogress"] object @ regular intervals. @ end of thread batchprogress object has status set "complete", when jquery queries it, sees complete status , removes progress object application.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -