如何确定登录者是否处于活动状态 [英] how to find out that wether the login person is active or not

查看:65
本文介绍了如何确定登录者是否处于活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi

我在Web应用程序中遇到了活动用户和非活动用户的问题,当用户登录时,我将数据库中的状态更改为1,而当用户注销时,我将数据库中的状态更改为0
到现在为止一切都很好,

当用户退出浏览器但未注销时,我如何找到这种类型的用户在数据库中将状态更改为0


是否有任何想法来更改数据库中的状态,通常在这种情况下,程序员应该做什么

所以请给我一个主意.

在此先感谢

hi

i am facing a problem with the active user and inactive user, in my web application that when user login i am changing the status as 1 in database,and when user logout, then iam changing the status as 0 in database
upto now every thing is fine ,

when the user exits the browsers without loging out, then how can i find this type of user to chage the status as 0 in database


is there any idea to change the status in the database , generally in this type of situations what the programers should do

so please give me an idea.

thanks in advance

推荐答案

您可以在pageunload事件中更新数据库,

并且您还可以使用触发器在会话的特定时间间隔(例如1小时,1天等)之后更新数据库
You can update database on pageunload event,

and you can also use trigger to update the database after specific interval of time (for eg 1 hour,1 day etc) on the base of session


这是一个触发的asp.net控件浏览器上的服务器端回调事件关闭.用这个

http://www.aspfr.com/codes/ASP- NET-SAVOIR-QUAND-UTILISATEUR-FERME-FENETRE-VIA_53700.aspx [如何在浏览器关闭时结束用户会话 [ ^ ]

破坏会话并在关闭浏览器窗口时注销用户点击注销按钮 [在浏览器退出时强制注销 [如何运行用户关闭浏览器时服务器端功能(不刷新)? [
Here is a asp.net control that fires a server side callback event on browser close. Use this one

http://www.aspfr.com/codes/ASP-NET-SAVOIR-QUAND-UTILISATEUR-FERME-FENETRE-VIA_53700.aspx[^]

Other links that you can use are

How to end user session when browser closed[^]

destroy session and logout a user when browser window is closed instead of clicking logout button[^]

Force log off on browser exit[^]


How to run server side function when user close the browser (not refresh)?[^]


您好,


您可以在global.asax中获取session_end()事件.
在这种情况下,您可以编写代码以在数据库中设置零.
hello,


you can get the session_end() event in global.asax.
on that event you can write code to set zero in database.


这篇关于如何确定登录者是否处于活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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