Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to lock user using forms authentication

Coding Platform: ASP.NET 4.0 Webforms with C#

I have two roles admin and member.
In my application, admin can manipulate most of the member data.
I know that in forms authentication a user can be unlocked like,

            MembershipUser user = Membership.GetUser(clickeduserName);
            user.UnlockUser();
            Membership.UpdateUser(user);

My questions are,

  1. How to lock a user in forms authentication?
  2. Why is MembershipUser.IsLockedOut Property set as ReadOnly?
  3. Is it not the right way to LockOut people as an administrator?
like image 808
naveen Avatar asked Mar 13 '11 05:03

naveen


1 Answers

There are a few options discussed here: http://forums.asp.net/t/1435151.aspx

They vary from using IsApproved (settable) instead of IsLockedOut to mucking with the underlying SQL database to set the lockout flag.

like image 65
Robert Levy Avatar answered Sep 28 '22 01:09

Robert Levy