views:

123

answers:

3

Hi All,

I'm using formsAuthentication and as an admin user to the site i would like to be able to sign another user out. Is this possible ?

A: 

No it's not. You could probably write something that intercepts authentication, and if it detects a user in the list of users to be logged out does it, but even then what happens if a session times out due to inactivity? The user would never have hit that authentication event and would still be queued.

blowdart
A: 

You could do the following:

  1. Write a custom http module and in the AuthenticateRequest event check to see if a user is authenticated and get his username.
  2. Look up in some common store (probably a database) for a list of users to be signed out.
  3. If the user is in this list sign him out.
  4. Remove the user from the list of users to be signed out.

And as an administrator you could update the list of users to be signed out.

Darin Dimitrov
+1  A: 

Yes it is and you dont even need to write a HttpModule to do it: FormsAuthenticationModule.Authenticate. Simply have your event handler take a look at the incoming user and if its in some list of people to be signed out remove them from the list & sign them out.

JeffreyABecker