Openldap authentication RRS feed

  • Question

  • User-851552593 posted

    Hi all:

    My client wants to do authentication via openldap, and I try very hard to connect successfully! But I still can not do authentication as they expect. The following code is what I write:


    1    DirectoryEntry nRoot = new DirectoryEntry("LDAP://your ip/o=xxx,c=xxx");
    2    nRoot.AuthenticationType = AuthenticationTypes.None;
    3    nRoot.Username = "uid=xxx,ou=xxx,o=xxx,c=xx";  //full dn
    5    nRoot.Password = "xxx";
    7    DirectorySearcher nDS = new DirectorySearcher(nRoot);
    8    nDS.SearchScope = SearchScope.Subtree;
    9    nDS.Filter = "uid=peter";
    10   //nDS.PageSize = 1000;
    12   SearchResult sr = nDS.FindOne(); 
    14    string path = sr.Path;
    15   string userDN = path.Substring(path.IndexOf("employeenumber")); //I get the authenticated user base dn

    My client only gives me one account which has permissions to connect openldap, but the authenticated account has no permisison of openldap, so I need to do authenticatoon(or binding) job under previous connection. I don't know how to do? Thanks!





    Wednesday, February 7, 2007 9:57 PM

All replies

  • User-1041979202 posted


    I need authentication my users against an OpenLDAP server with C#.NET too.

    when you write the following code:

    DirectoryEntry nRoot = new DirectoryEntry("LDAP://your ip/o=xxx,c=xxx");

    please, could you tell me how do you obtain the ip? is the ip of the OpenLDAP server or the IP address of  the host making the request?

    the only path that I have of OpenLDAP server is something like this: xxxxx.xx.xxx.es but I don't know how to obtain the Ip.




    Thursday, February 8, 2007 10:43 AM
  • User-851552593 posted

    I'm sorry that I made a mistake. It's your ldap server ip or url

    DirectoryEntry nRoot = new DirectoryEntry(LDAP://your ldap ip or url/o=xxx,c=xxx);




    Friday, February 9, 2007 8:34 PM