【发布时间】:2010-12-26 22:11:41
【问题描述】:
我可以通过 SQL 强制注销 asp.net 会员帐户吗?
【问题讨论】:
-
我添加了“forms-authentication”标签,因为在下面的评论中声明这是身份验证模式。
标签: asp.net sql asp.net-membership forms-authentication
我可以通过 SQL 强制注销 asp.net 会员帐户吗?
【问题讨论】:
标签: asp.net sql asp.net-membership forms-authentication
Forms Authentication 模式下没有存储当前登录用户的记录,因此仅通过一些 SQL 执行将用户注销是不可能的。
请注意,像 SQL 这样的数据存储仅在表单身份验证生命周期的实际凭据身份验证步骤中使用:
Forms authentication control flow http://i.msdn.microsoft.com/Aa480476.formsauth(en-us,MSDN.10).gif
表单身份验证通常利用客户端 cookie 来处理当前登录的用户。
【讨论】:
对于表单身份验证,您可以使用:
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
如果您尝试通过 Windows 身份验证执行此操作,请参阅 this。
【讨论】: