多重登录不允许网站 [英] Multi Login not allowed for a website

查看:95
本文介绍了多重登录不允许网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我必须创建一个不允许同一用户多次登录的网站。

我的意思是,假设我的网站是从机器A登录的,当我尝试从机器B登录时,网站应该从机器A注销。

当我再次尝试登录机器A时,应用程序应该触发在机器B注销。



任何帮助我这个实现都很明显。

谢谢

Hi,

I have to create a website which should not have multiple login for same user not allowed.
I mean, say suppose my website is logged in from Machine A, when I try to login from Machine B, the website should logout from Machine A.
When I again try to login in Machine A, the application should trigger a logout at Machine B.

any help me for this implementation is appreciable.
Thank you

推荐答案

我过去所做的是在用户登录时发出(并在数据库中存储)令牌(guid),并且必须为所有后续访问提供该令牌。 />
在您的方案中,当用户从计算机B登录时,将生成一个新令牌,并且计算机A上的进程所持有的令牌将不再有效,因此从该计算机访问将失败,直到新的从那里开始登录。



我真的很惊讶这不是一种常见的技术。
What I have done in the past is to issue (and store in the database) a "token" (guid) when a user logs in and that token must be provided for all subsequent access.
In your scenario, when the user logs in from machine B, a new token will be generated and the one that the process on machine A holds will no longer be valid so access from that machine will fail until a new login is performed from there.

I'm really surprised that this is not a common technique.


请尝试以下链接:阻止用户拥有多个并发会话



关于ASP.NET的一个常见问题是如何可以阻止用户同时登录多次。不幸的是,ASP.NET的本质意味着您无法判断用户是否已登录。当然你可以记录用户访问你的应用程序的事实,但是没有办法告诉他们已经放弃他们的旧会话,可能是关闭他们的浏览器,并且他们的新登录是有效的。



该链接包含一个SingleSessionPreparation类,可帮助您跟踪GUID。
Please try this link : Preventing a User From Having Multiple Concurrent Sessions

A common question asked regarding ASP.NET is how can you prevent a user logging on more than once at the same time. Unfortunately, the nature of ASP.NET means that you cannot tell if a user is logged in already. Sure you can log the fact a user has accessed your application, but there is no way to tell that they have abandoned their old session, perhaps by closing their browser, and that their new login is therefore valid.

The link contains a class SingleSessionPreparation which helps you keep track of GUID.


这篇关于多重登录不允许网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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