I have a ASP.NET website where a user gets large data from a DB by clicking a button, but some times the user want to cancel the job(these jobs can take a very long time) and their session will hang while doing this job.
Is there any way to stop the execution of code and clean the already collected data ?
Is the best solution to have a table with all the jobIDs where a bit will determine if the code can continue and let the user change this from a button/link.
You may consider using AJAX and abort the current Request if the user hits a cancel button.
Just put the database query in the corresponding serverside eventHandler