从浏览器登录了,如果布劳尔在ASP.NET的关闭? [英] log out from browser if the brower closes in asp .net?

查看:124
本文介绍了从浏览器登录了,如果布劳尔在ASP.NET的关闭?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是复杂一点。 一个用户使用Web浏览器访问的数据的基础上,在访问数据的基础上,如果用户关闭了活动页面,而不是注销会议 - 该次会议需要被自动注销。   可有人指导我如何做呢? 我使用jQuery的 - 在母版页

my requirement is bit of complicated . an user is accessing the data base using the web browser, while accessing the data base if the user is closed the active page instead of log out the session - that session needs to be log out automatically. can some one guide me how to make this ? i am used jquery - in the master page.

onbeforeunload的 - 我得到消息,离开页面或留在这个页面。 即使我得到这个消息,同时登录和系统,查看主页了。

onbeforeunload - i am getting message leave the page or stay with this page. even i am getting this messages while login and and view the home page too.

推荐答案

这是样品code

  window.onbeforeunload = function () {
   return 'You want to leave?';
};​​

看演示这里

我认为它可以发送一个Ajax请求,你可以看到你的服务器,用户关闭浏览器的标签。

I think its possible to send an ajax request and you can saw your server that the user closed the browser's tab.

另外这一个jquery插件称为jquery.idle,它是用来识别该用户是否活跃。

Also this a jquery plugin called jquery.idle, which is used to identify if the user is active.

请参照本<一个href="http://stackoverflow.com/questions/667555/detecting-idle-time-in-javascript-elegantly">Detecting空闲时间在JavaScript优雅会为您提供更多的想法。

Refer this Detecting idle time in JavaScript elegantly will gives you more idea.

这篇关于从浏览器登录了,如果布劳尔在ASP.NET的关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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