log out asp.net user through sql?

2019-08-30 02:32发布

Can I force a log out through SQL for asp.net membership account?

2条回答
Deceive 欺骗
2楼-- · 2019-08-30 03:01

For forms authentication you can use:

FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();

If you are trying to do this through Windows authentication see this.

查看更多
等我变得足够好
3楼-- · 2019-08-30 03:20

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

查看更多
登录 后发表回答