[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

The user account has been locked out - when trying to access ASPNET membership objects

Posted on 2011-05-03
4
Medium Priority
?
2,344 Views
Last Modified: 2012-05-11
I'm have a big problem brought the user administration part of my application down.  

I have a User Administration page that allow displays .net membership users.  I have a membership utility class that interacts with the .net membership objects, like MembershipUserCollection.  Out of the blue I got a "The user account has been locked out" message when I go to my UserAdmin.aspx page.  NOTE: My .net user is NOT locked out, I have checked and am able to see all other pages in my application.  So I'm guessing that my custom utility class is somehow locked out.  Could this be?  I hope so, because I'm really stuck.  Ideas?  How to fix?

Code below is some of the code in my custom membership utility class, that interacts with the .net membership objects.  There is much more, but this looks like the last thing to pass in the stack track message.  I can't create this error in Development so I stepping through doesn't help.

Here's the error message:
      The user account has been locked out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Security.MembershipPasswordException: The user account has been locked out.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[MembershipPasswordException: The user account has been locked out.]
   System.Web.Security.SqlMembershipProvider.GetPassword(String username, String passwordAnswer) +1860247
   MembershipUtil.ConvertMembershipUtilMembership(MembershipUser usr) +78
   MembershipUtil.GetMembershipUtils() +124
   MembershipUtil.GetAllClients() +629

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
   System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +488
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


private static MembershipUtil ConvertMembershipUtilMembership(MembershipUser usr)
	{
        // Declare a Profile object for the user
        ProfileBase p = ProfileBase.Create(usr.UserName.ToString());
        
		MembershipUtil MembershipUtil = new MembershipUtil();
		MembershipUtil.Username = usr.UserName;
        if (Membership.Provider.GetPassword(MembershipUtil.Username, String.Empty) != null)
        {
            MembershipUtil.Password = Membership.Provider.GetPassword(MembershipUtil.Username, String.Empty);
        }
        else
            MembershipUtil.Password = "N/A";
        
        if (p.GetPropertyValue("FirstName") != null)
        { MembershipUtil.FirstName = p.GetPropertyValue("FirstName").ToString(); }
        else
        { MembershipUtil.FirstName = ""; }
        
        if (p.GetPropertyValue("LastName") != null)
        { MembershipUtil.LastName = p.GetPropertyValue("LastName").ToString(); }
        else
        { MembershipUtil.LastName = ""; }

        //if (p.GetPropertyValue("Contact") != null)
        //{ MembershipUtil.Contact = p.GetPropertyValue("Contact").ToString(); }
        //else
        //{ MembershipUtil.Contact = ""; }

        if (p.GetPropertyValue("Company") != null)
        { MembershipUtil.Company = p.GetPropertyValue("Company").ToString(); }
        else
        { MembershipUtil.Company = ""; }

        if (p.GetPropertyValue("Initials") != null)
        { MembershipUtil.Initials = p.GetPropertyValue("Initials").ToString(); }
        else
        { MembershipUtil.Initials = ""; }
        
        if (p.GetPropertyValue("Phone") != null)
        { MembershipUtil.Phone = p.GetPropertyValue("Phone").ToString(); }
        else
        { MembershipUtil.Phone = ""; }

        //if (p.GetPropertyValue("FAX") != null)
        //{ MembershipUtil.FAX = p.GetPropertyValue("FAX").ToString(); }
        //else
        //{ MembershipUtil.FAX = ""; }

        if (p.GetPropertyValue("PRO") != null)
        { MembershipUtil.PRO = p.GetPropertyValue("PRO").ToString(); }
        else
        { MembershipUtil.PRO = ""; }

        if (p.GetPropertyValue("Nickname") != null)
        { MembershipUtil.Nickname = p.GetPropertyValue("Nickname").ToString(); }
        else
        { MembershipUtil.Nickname = ""; }
       
		MembershipUtil.EmailAddress = usr.Email; 
		MembershipUtil.UserRole = GetUserRole(usr.UserName);
		MembershipUtil.IsApproved = usr.IsApproved;
		MembershipUtil.IsLockedOut = usr.IsLockedOut;
		return MembershipUtil;
	}

Open in new window

0
Comment
Question by:JT_SIRO
  • 3
4 Comments
 
LVL 9

Expert Comment

by:radcaesar
ID: 35517909
0
 

Author Comment

by:JT_SIRO
ID: 35517991
I know how to reset a password for a user.  My logged in user is not locked.  How do I reset it for a class that is trying to access .net?  

It is this code that it fails on in my MembershipUtil class:

        if (Membership.Provider.GetPassword(MembershipUtil.Username, String.Empty) != null)
        {
            MembershipUtil.Password = Membership.Provider.GetPassword(MembershipUtil.Username, String.Empty);
        }

0
 

Accepted Solution

by:
JT_SIRO earned 0 total points
ID: 35881798
It was because one of the members was locked out and I was looping through them.  My user wasn't actually logged out.
0
 

Author Closing Comment

by:JT_SIRO
ID: 35910031
It was because one of the users I looped through, was logged out.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question