简体   繁体   中英

C# LDAP against LDS


I'm trying to resolve this problem but I cannot get this to work.
The Question

What is wrong with my query?

The Code

private static void ExecuteQuery()
        {
            string sDomain = "10.12.14.165:389";
            string sDefaultOU = "CN=GeneralUsers,CN=Company,DC=Server,DC=LDS,DC=LOCAL";
            string sServiceUser = "myUser";
            string sServicePassword = "myPassword";


            DirectoryEntry ldapEntry = new DirectoryEntry("LDAP://" + sDomain + @"/" + sDefaultOU,
                                                          sServiceUser,
                                                          sServicePassword);

            DirectorySearcher ldapSearcher = new DirectorySearcher(ldapEntry);
            //Error Occurs here
            SearchResultCollection ldapResult = ldapSearcher.FindAll();
        }

The Error

@ SearchResultCollection ldapResult = ldapSearcher.FindAll();
Exception: There is no such object on the server.

Attention

The Object DOES Exist

The problem occured in the LDS Configuration. the user I was authenticating with had no rights to the LDS, the query I was using was working fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM