C#WebPages:管理退出事件或不使用用户操作服务器端即可退出 [英] C# WebPages : manage Exit events or quit with no user action server side
问题描述
当用户不执行任何操作退出到其他页面时,管理退出或退出事件的更好的解决方案是什么?此事件仅需要一次引发,并且对于删除放弃此页面后未存储的所有临时文件或数据很有用.是完美用作清洁方法服务器端的方法.谢谢.
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.
推荐答案
网络是无状态的,因此实际上不需要清理任何内容.但是,有时您可能想在用户尝试关闭浏览器时终止会话.我想您可以捕获该事件,然后在关闭窗口之前调用服务器(使用AJAX):
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:
虽然恕我直言,但并非100%可靠!
Not 100% reliable though IMHO!
这篇关于C#WebPages:管理退出事件或不使用用户操作服务器端即可退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!