如果同一帐户从两台不同的计算机同时登录,则自动注销用户。 [英] Auto logout user if same account is logged in from two different machine at same time.

查看:129
本文介绍了如果同一帐户从两台不同的计算机同时登录,则自动注销用户。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我要求如果两个用户同时使用相同的用户ID和密码从两台不同的机器登录,那么它不应该允许第二个用户进入系统。这意味着只有一个用户可以从一台机器一次登录。



提前致谢。

解决方案

您可以这样做可以管理Loggedin用户的表....用一个名为loggedInStatus(1/0)的列

..在登录时检查如果loggedInStatus为true则那么..do未登录用户..



但是您也可以使用System.Web.Caching.Cache对象来跟踪用户当前会话。如果在缓存对象中找到信息失败,则回退到从数据库中读取信息然后将该信息放在缓存中以便后续请求。




您还可以查看此主题...



http://stackoverflow.com/questions/1042892/how-to-prevent-simultaneous-login-with-same-user-on- different-pcs [ ^ ]


将当前用户保存在会话或内存中,当任何用户登录时,检查用户的状态。

Hi,

I have requirement where if two users logged in with same userid and password from two different machines at the same time then it should not allow second user to get into the system. It means only one user can login at one time from one machine.

Thanks in advance.

解决方案

You can do this may managing a table for Loggedin Users....with a column called loggedInStatus(1/0)
.. at the time of login check if loggedInStatus is true then..do not logged in user..

However you could also use the System.Web.Caching.Cache object to track a users current session as well. If finding the info in the cache object fails fall back to reading it from the DB then place that info in the cache for the benefit of subsequent requests.


You Can Also check this thread...

http://stackoverflow.com/questions/1042892/how-to-prevent-simultaneous-login-with-same-user-on-different-pcs[^]


Save the current user in session or in the memory,when any user login,check the state of the user.


这篇关于如果同一帐户从两台不同的计算机同时登录,则自动注销用户。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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