Jeremy Wadsworth
My Contribution to the ASP.NET Community


Welcome   
Welcome to my personal website. Here you will find blog posts related to web development as well as personal related interests. If you're here for the source code to my Personal Web Site Kit, please register and you'll receive an email when your account has been approved.


Latest Blog Entries

 Friday, December 29, 2006


The user account has been locked out    
I came across this error today in the user management page of one of my web applications. I have a grid that I’m filling with all the users in the system along with their information. In this grid I am also showing the passwords for each user. I know, not the best security. However, I am using SSL.

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()


jeremy at 3:57 PM | (10) Comments | Add a comment | Permalink





Commments
Nigel said...

Had a similar problem the other day, but with the admin password. Eventually went into sql manager at host control panel and unlocked there. As usual took me ages to discover this. Keep well

Saturday, January 27, 2007 11:35 AM

Matt Morrison said...

Thanks for the tip! I haven't had to use any of your little gems yet but I'm sure one day i'll stumble over something that would have taken me loads of time, but i'll say "ah yes, Thanks Jeremy!" ;)

Thursday, March 01, 2007 1:43 PM

Don said...

Thanks! -Don

Tuesday, May 22, 2007 10:55 PM

cm said...

ah yes, Thanks Jeremy!" ;)

Thursday, September 27, 2007 6:35 AM

Aftab Ahmed Kalhoro said...

I got rid of this error from your tip. Thanks a lot Jeremy.

Saturday, September 06, 2008 11:17 PM

EL ALFRE.. said...

JUST GO TO THE SQL TABLE ASPNET_MEMERSHIP AND CHANGE TO FALSE THE COLUMN ISLOCKEDOUT

Friday, October 31, 2008 9:42 AM

Murugan.N said...

Thanks For this solution.

Wednesday, November 26, 2008 6:00 AM

taher said...

thanks a lot

Monday, July 06, 2009 3:23 AM

elizabeth pepper said...

i called friday about my account i cant check it out on the internet

Monday, October 26, 2009 7:07 AM

Tiffany jewellery said...

Thanks For this solution.

Friday, July 16, 2010 9:23 PM

  Leave a comment

Enter Your Name:
 
Enter your website
Security code from image below:  
Need Custom Controls Work or Training?
   


Join WebHost4Life.com






If you would like to help support this project, please click the button below to make a small donation.