[英]c# FormsAuthentication signOut another user
I'm using formsAuthentication and as an admin user to the site i would like to be able to sign another user out. 我正在使用FormsAuthentication,并且作为该站点的管理员用户,我希望能够注销另一个用户。 Is this possible ?
这可能吗 ?
Yes it is and you dont even need to write a HttpModule to do it: FormsAuthenticationModule.Authenticate . 是的,您甚至不需要编写HttpModule即可: FormsAuthenticationModule.Authenticate 。 Simply have your event handler take a look at the incoming user and if its in some list of people to be signed out remove them from the list & sign them out.
只需让您的事件处理程序查看传入的用户,如果它在某些要注销的人员列表中,请从列表中将其删除并注销。
No it's not. 不,这不对。 You could probably write something that intercepts authentication, and if it detects a user in the list of users to be logged out does it, but even then what happens if a session times out due to inactivity?
您可能编写了一些东西来拦截身份验证,并且如果它检测到要注销的用户列表中的某个用户,它是否可以进行身份验证,但是即使会话由于不活动而超时,会发生什么呢? The user would never have hit that authentication event and would still be queued.
用户将永远不会遇到该身份验证事件,并且仍然会排队。
You could do the following: 您可以执行以下操作:
And as an administrator you could update the list of users to be signed out. 作为管理员,您可以更新要注销的用户列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.