problem getting User Group Memebership in Active Directory

Discussion in 'ASP .Net Security' started by Patrick Olurotimi Ige, May 9, 2005.

  1. I have a .aspx page that gets USERS GROUPS from the Active Directory
    after inputing the USERNAME of the user in a textbox.

    And this has been working for me.
    But now i get the error:-

    "An Error occurred while getting group memberships
    The referenced account is currently locked out and may not be logged on
    to"

    An ideas what is wrong?




    *** Sent via Developersdex http://www.developersdex.com ***
     
    Patrick Olurotimi Ige, May 9, 2005
    #1
    1. Advertisements

  2. It sounds like the referenced account may be locked. If you can show a
    short code sample that demonstrates this problem, that would be helpful.

    Joe K.

    "Patrick Olurotimi Ige" <> wrote in message
    news:...
    >I have a .aspx page that gets USERS GROUPS from the Active Directory
    > after inputing the USERNAME of the user in a textbox.
    >
    > And this has been working for me.
    > But now i get the error:-
    >
    > "An Error occurred while getting group memberships
    > The referenced account is currently locked out and may not be logged on
    > to"
    >
    > An ideas what is wrong?
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
     
    Joe Kaplan \(MVP - ADSI\), May 9, 2005
    #2
    1. Advertisements

  3. Joe thanks for the reply but 'm getting the error when i try
    retrieving the GroupMemberships.
    Patrick


    private string[] GetGroupMemberships(string path, ref int
    primaryGroupID)
    {
    StringBuilder groupNames = new StringBuilder();
    try
    {
    DirectoryEntry entry = new DirectoryEntry(path);

    string[] properties = {"memberof", "primarygroupid"};

    entry.RefreshCache(properties);

    // invoke Groups method which will get all groups
    // user is member of even primary group

    object groups = entry.Invoke("Groups");

    // the read group name from collection
    foreach (object group in (IEnumerable)groups)
    {
    DirectoryEntry groupEntry = new DirectoryEntry(group);
    groupNames.Append(groupEntry.Name);
    groupNames.Append("|");
    groupEntry.Dispose();
    }

    // set primary group id
    primaryGroupID =
    Convert.ToInt32(entry.Properties["primarygroupid"].Value);
    entry.Dispose();
    }
    catch (Exception ex)
    {
    Response.Write("<font color=red>An Error occurred while
    getting group memberships. " +
    ex.Message + "</font>");
    Response.End();
    }
    return groupNames.ToString().TrimEnd(new char[]{'|'}).Split(new
    char[]{'|'});
    }



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Patrick Olurotimi Ige, May 10, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Diego F.
    Replies:
    6
    Views:
    65,202
    zullu
    May 31, 2007
  2. Liming

    Memebership, Role, Profile Provider

    Liming, Jan 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    660
    john smith
    Jan 7, 2006
  3. zieg
    Replies:
    0
    Views:
    2,470
  4. moi
    Replies:
    2
    Views:
    3,088
    Marc Scheuner
    Apr 22, 2006
  5. Dirk Hagemann
    Replies:
    3
    Views:
    715
    Dirk Hagemann
    May 4, 2007
  6. Replies:
    2
    Views:
    6,941
  7. mpnordland
    Replies:
    24
    Views:
    1,189
  8. Ken
    Replies:
    0
    Views:
    748
Loading...