I have an ASP.NET WebForm application - a main page that hosts a bunch of IFRAME "widgets". When main page loads - the widgets' pages load as well and begin their own processing, which include connecting to SQL Server to run stored procedures.
What would be the best way to cancel those IFRAME processing should user need to do so? I could probably set their SRC to another/blank page from client-side thus canceling the request, but if the IFRAME pages already called SQL Server - how do I cancel the SQL processing as well?
EDIT: To clarify the slowest point in the IFRAMEd page is the SQL Server stored procedure call, so essentially this boils down to - can I initiate cancellation of the SQL command from client?
One solution that came up in my mind is to have a static List
of currently Running SqlCommands
, whenever user invokes cancel you can extract the Command from this static list, and then cancel it. The page that is executing the command will receive the command cancel exception, it then can handle it appropriately.
Here are the things that you need to handle:
SqlCommand
using that key and call its Cancel
method.