views:

87

answers:

2

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

+1  A: 

For forms authentication you can use:

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

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

David Glass
I specifically asked for SQL.
progtick
Not sure I understand than, what do you mean through SQL. What Authentication are you using? Forms, Windows, or Passport?
David Glass
I am using Forms Authentication. But I am trying to log someone out inside of my SQL code, but that seems impossible.
progtick
+1  A: 

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

Forms Authentication generally utilizes client-side cookies to handle currently logged in users.

Source: Explained: Forms Authentication in ASP.NET 2.0

ddc0660