Can I force a log out through SQL for asp.net membership account?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
No record of currently logged in users are stored in Forms Authentication mode so it would be impossible to log out a user by some SQL execution alone.
Note that a data store like SQL is only used during the actual credential authentication step of the Forms Authentication lifetime:
Forms authentication control flow http://i.msdn.microsoft.com/Aa480476.formsauth(en-us,MSDN.10).gif
Forms Authentication generally utilizes client-side cookies to handle currently logged in users.
Source: Explained: Forms Authentication in ASP.NET 2.0
回答2:
For forms authentication you can use:
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
If you are trying to do this through Windows authentication see this.