自动注销 [英] automatic logoff

查看:56
本文介绍了自动注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我想知道,如果我已登录应用程序,并且尝试使用相同的用户名和密码登录到另一个会话,我希望较早的登录会话应自动注销,并允许我登录最近的会话.任何人都可以帮助我.

Hello friends,

I want to know , if i am logged in application , and i am trying to loggin into another session with same username and password, i want the earlier logged in session should logout automatic and allow me to logged in recent session. anybody can help me out.

推荐答案

在数据库中维护"LastLoggedIn"日期时间字段或"IsAlreadyLoggedIn"标志.有人登录后,填充该用户登录的标志.连同身份验证一起,传递某些密钥,以便您可以检查当前登录名是否具有当前密钥.
如果匹配,则让执行继续进行.如果不是,则用您在其他地方登录的消息强行注销用户.
Maintain ''LastLoggedIn'' datetime field or ''IsAlreadyLoggedIn'' flag in your DB. Once someone log''s in, populate the flag that user is logged in. Along with authentication, pass on certain key along with it such that you can check if the current login has the current key or not.
If it matches, let the execution move ahead. If not then forcefully log the user out with message that you logged in somewhere else.


如果您要谈论的是不同的登录位置,请使用IP,或者可以在数据库中有一个标志或用于保存会话变量名称的内容,然后在再次登录时-删除旧的会话变量名称,并将其取值为u从数据库中获取的值.

基本上
use IP''s if your talking about different locations logging in, or you can have a flag in database or something to hold a session variable name and when its logging in again - delete the old session variable name with the value u took from the database.

basically
login_click(){
   Session.Contents.Remove(sqlConn.ExecuteScalar("select SessionVarName from UserTable where userid = ''" + txtLoginID + "''");
}


这篇关于自动注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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