C# LDAP against LDS

1.1k Views Asked by At


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

1

There are 1 best solutions below

0
Nick Prozee On BEST ANSWER

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.