关于ASPNET_Membership用户被锁的解决

转:http://jeremywadsworth.com/Default.aspx?blogentryid=42
总结如下:
      使用ASPNET_Membership用户登录失败,用户被锁。两种方法解锁。
     1.手工修改ASPNET_Membership 数据库表的IsLockedOut的字段为False;
     2.程序修改,For Each user As MembershipUser In memberList
                                 If user.IsLockedOut = True Then user.UnlockUser()

原文如下:

The user account has been locked out
The error occurred when a user got locked out and then the administrator tried to go in and view the grid of users. When the code tried to retrieve the password for the locked out user, a MembershipPasswordException error was thrown. You can’t retrieve certain information for a user in ASP.NET 2.0 when that user has been locked. In the ASPNET_Membership table the column is IsLockedOut. When this column is set to 1 for a user in the table, you will not be able to retrieve the password.

A user gets locked out when they have too many failed login attempts and usually only get locked out for 10 minutes unless you’ve changed it to be a longer period.

In order to get around this error, I have to check if the user is locked out before trying to retrieve their password. If they are locked out I just call the UnlockUser method off of the membershipuser object. The following code illustrates this.

For Each user As MembershipUser In memberList
   If user.IsLockedOut = True Then user.UnlockUser()

你可能感兴趣的:(职场,net,休闲,Membership)