Context: We have a very large ASP.NET Web Forms application and some pages/modules are very 'heavy' and it takes very long time to process this request. So the problem is when you misclick on the wrong menu to load a page you'll have to wait a long time for nothing. A solutio开发者_如何学Gon is to refresh de browser (F5, or change URL) but I'm I right that de server is still processsing its request till a certain time?
The more problem with F5 in our application is that we don't preserve all states (lots of iframes etc) so the user needs to start over again.
My ideal situation would be: get a list from all current/running requests and abort the one you want to stop directly from processing. (is this even possible? what if its in the middle of a code block, can it terminate a thread or something? Do I need IIS?)
I've tried something with a custom HttpHandler that holds a list for all HttpContext objects. That will work but isn't probably the best solution. And for stopping a request i've tried Response.End() but then I get a complete white screen, are there better ways to selectivly abort a request?
You can check HttpResponse.IsClientConnected
and end the processing if false
, check the conditions under which the flag is true
to make sure it will work for you http://msdn.microsoft.com/en-us/library/system.web.httpresponse.isclientconnected.aspx
精彩评论