Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
how to execute a long running task in asp.net
Posted
Comments
Sandeep Mewara 21-Jun-12 15:14pm    
Backgroundworker in ASP.NET?
[no name] 21-Jun-12 15:25pm    
Ah right
Sandeep Mewara 21-Jun-12 15:14pm    
Can you elaborate more on what are you trying to do?
db7uk 21-Jun-12 17:57pm    
I have added a solution to what little information you have provided. Please elaborate more so that the solutions can be more suited to your needs. "Improve Question"

MSDN: backgroundworker [^]

and have a look at the the CancelAsync() method as this will allow you to cancel the background worker. It has a good example in there.

[Edit]

I have done some more reading and as this forum thread states you can use a background worker thread BUT it is advisable not too.

How to do a background thread in asp.net[^]
 
Share this answer
 
v2
Comments
Sandeep Mewara 21-Jun-12 15:14pm    
In ASP.NET?
Simon_Whale 21-Jun-12 17:44pm    
yes they can be done in ASP.NET, but as I have just read they are not the best way to do such a thing my updated answer will point to a good reason why you shouldn't do it! this can be my something learnt for the day!

Thank you simon
Sandeep Mewara 21-Jun-12 23:13pm    
Okay. It's another thread running but not 'backgroundworker' class usage in ASP.NET.

Your link after update clears/confirms it out. Thanks.
One way would be to use reverse ajax / comet to provide a means for the server to complete and then notify the client.

http://en.wikipedia.org/wiki/Comet_(programming)[^]

Another method would be to use SignalR

http://ruwandotnet.wordpress.com/category/signalr/[^]
http://sachabarbs.wordpress.com/2012/01/21/signalr-best-thing-since-slice-bread/[^]

Which ever root you take in essence you create a polling / long running connection to the server and when the server processing is complete you then update the client.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900