locked
how to create a user in ldap in given domain? RRS feed

  • Question

  • User-1800127182 posted

    Hi,

    how to create the user in the given domain

    my path is like this LDAP://server:389/CN=Users,DC=xyz

    when i try to create it is was giving me the below error

    directory services a referral was returned from the server

    thanks,

     

    Tuesday, March 5, 2013 2:36 PM

Answers

  • User1508394307 posted
    DirectoryEntry container = new DirectoryEntry("LDAP://...");
    
    using (container)
    {
        DirectoryEntry newObject = container.Children.Add("CN=New User", "user");
    
        using (newObject)
        {
            //now add properties as appropriate;
            newObject.Properties["uid"].Add("newuser1");
            newObject.CommitChanges();
        }
    }

    If you search you can find multiple posts regarding same matter, e.g. 

    http://forums.asp.net/t/1683986.aspx/1

    Hope this helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 11, 2013 3:44 PM