C# WebPages : manage Exit events or quit with no user action server side

最后都变了- 提交于 2019-12-24 19:07:13

问题


What is the better solution to manage Exit or Quit events when user exit to other pages with no action?. This event need to be raised only one time and be usefull to delete all temporary files or datas not stored after the abandon of this page. Is a perfect to use as cleaning method server side. Thanks.


回答1:


The web is stateless so there shouldn't really be anything to clean up. However, sometimes you may want to kill the session when the user tries to close browser. I guess you could catch that event and then call the server (using AJAX) before closing the window:

How to capture the browser window close event?

Not 100% reliable though IMHO!



来源:https://stackoverflow.com/questions/2714583/c-sharp-webpages-manage-exit-events-or-quit-with-no-user-action-server-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!