difficultly stopping execution with a cancel button

A

alexander.glass

I have a buffered page that runs some code and outputs to the user to
update the progress of a method that takes several minutes to run. I
have a big problem however. There is no way to stop the code from
running once it begins. If you place a button on the page with code
that will trigger the method to stop, the button click event will not
fire until the long method completes. As a result, I can not think of
a way to create a cancel button. Has anyone had this problem before
and have a solution? Any help is greatly appreciated.

Alex
 
P

Peter Rilling

You might try running your process in some other thread so that it does not
block ASP.NET. What you could then do is store a reference to the thread in
a session variable so that when you click the button and the handler is
invoked, you can then access the thread and stop it. I have never done this
so I don't know if it will work, but you can try it.
 
A

alexander.glass

I tried using a delegate to run the procedure asynchronously but as
soon as the page_load event ends so does my thread. Is there some way
to keep the thread from aborting?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top