prevent多个同时登录 [英] Prevent Multiple Simultaneous logins
问题描述
我试图prevent多个同时登录我的Web应用程序。我想signout所有/用户的任何previous认证,当他们登录。使得当前登录仍然是唯一的一个。
I am trying to prevent multiple simultaneous logins in my web application. I want to signout all/any previous authentications of a user when they login. Such that the current login remains the only one.
我如何去调用FormsAuthentication.SignOut()为特定的用户无效任何现有的认证。
How do I go about calling FormsAuthentication.SignOut() for a particular user to invalidate any existing authentications.
我已经试过到处寻找,但没有答案,只有理论。
I have tried searching everywhere but no answers, only theories.
推荐答案
好吧,我结束了使用的应用程序状态存储用户的最新的SessionID,并在母版页检查,看看会话ID匹配。如果没有,那么在用户注销。
Well I ended up using the Application state to store the latest sessionid of a user and checking in the master page to see of the session ID matches. If not then the user is signed out.
这仅最新的允许登录和使用时的previous登录被注销。
That way only the latest login is allowed and any previous login is signed out when used.
这篇关于prevent多个同时登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!