简体   繁体   中英

How to stop server side processing when user clicks browser stop button (ASP.net C#)

I remember I could easily do this in PHP but can't seem to find an answer for ASP.Net. I have a web app that connects to Pop3 server to download emails when a user clicks a button or at set intervals. This process can take a very long time to finish depending on the number of emails to be downloaded. I noticed that when I click the browser stop button the process still continues to download emails preventing the user from navigating to another page. I have tried Response.IsClientConnected property but it doesn't seem to be working.

Any help would be highly appreciated.

You can't. The stop button in the browser will only stop rendering the response. The server however, will keep building the response till it's complete.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM