0

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

ddc0660
  • 3,972
  • 2
  • 20
  • 30
TPR
  • 2,557
  • 10
  • 40
  • 64
  • I added 'forms-authentication' tag since it was stated that was the auth mode in a comment below. – ddc0660 Dec 16 '09 at 16:08

2 Answers2

1

For forms authentication you can use:

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

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

Community
  • 1
  • 1
David Glass
  • 2,304
  • 1
  • 25
  • 35
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

ddc0660
  • 3,972
  • 2
  • 20
  • 30