这是可能的,以清除会话只要在浏览器关闭asp.net? [英] Is this possible to clear the session whenever browser closed in asp.net?

查看:124
本文介绍了这是可能的,以清除会话只要在浏览器关闭asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net应用程序,我想清楚了会议,每当我的浏览器关闭或我的标签(如果包含多个选项卡浏览器)关闭。

In my asp.net application, i want to clear the session whenever my browser closed or my tab (if my browser containing multiple tabs)closed.

请指引我走出这个问题...

Please guide me to get out of this issue...

推荐答案

短版,第
有一个服务器检测,如果客户端已经关闭其浏览器没有坚实的道路。这是web开发的异步模式只是本性。

Short version, No. There's no solid way of a server detecting if the client has closed their browser. It's just the nature of web development's asynchronous pattern.

长版,如果是真的,真的对你很重要;
放一点在发送后定期在后台您的网站页面的JavaScript,并成立了会议的部署,如果它不接收这些常规的心跳信号的服务器端代理或服务。

Long version, if it's really, really important to you; Put a bit of javascript in the page that sends a regular post to your website in the background and set up a serverside agent or service that disposes of the sessions if it doesnt receive these regular "heartbeat" signals.

您可以把一个javascript回发到页面上的卸载()事件,但不依赖于它,它总是犯规火。

You can put a javascript postback onto the page's unload() event but dont rely on it, it doesnt always fire.

这篇关于这是可能的,以清除会话只要在浏览器关闭asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆