There may be the need to programmatically logout the user in an asp.net application. If you’re using Forms authentication, this is very simple to do:

FormsAuthentication.SignOut();

You may also need to block the currently logged in / specific user from the system. This may be needed to avoid th possibility of someone doing brute force attacks to get to site data (once they’re logged in). This is also quite simple:

MembershipUser user = Membership.GetUser(); //to block currently logged in user

MembershipUser user = Membership.GetUser(“username”); //To block a specific user:

user.IsApproved = false; Membership.UpdateUser(user);

To unblock the user, all you’d need to do is:

MembershipUser user = Membership.GetUser(“username”); user.IsApproved = true; Membership.UpdateUser(user); 

Hope that helps.

Shout it