3

In my site administrator can view list all other online users.

Administrator can also disable any account from that list.

Everything was going fine so far. But now I decided to log out the user which is being disabled. How can I do a log out operation for a particular user from the above specified online user list?

NOTE: I'm using default membership schema for my SQL Server database.

LittleBobbyTables - Au Revoir
  • 31,192
  • 25
  • 105
  • 113
Krishanu Dey
  • 6,212
  • 6
  • 50
  • 67

1 Answers1

2

You cannot logout a user from outside of their session. See Programatically logout an ASP.NET user for a possible workaround.

Community
  • 1
  • 1
DaveB
  • 9,386
  • 4
  • 37
  • 63
  • 1
    Thanks a lot. the above link helped me a lot. I added the following code to page_load event and it worked perfect. `if (Page.User.Identity.IsAuthenticated) { MembershipUser user = Membership.GetUser(Page.User.Identity.Name); if (!user.IsApproved) { HttpContext.Current.Session.Abandon(); FormsAuthentication.SignOut(); Response.Redorect("Default.aspx"); } } ` – Krishanu Dey Apr 29 '12 at 18:13