1
Answer

ADSI and Directoryservice

Pallavi

Pallavi

17y
2.3k
1
Hi,

I am developing a login screen to validate users using Active directory.

The form works fine when I use the following using ADSI. Following is the code using ASIM

objLoginSuccess = objNameSpace.OpenDSObject("LDAP://ldap.test.org:200/OU=Users,DC=testDir,DC=Org", _

"CN=" & LoginInfo.UserName & ",OU=Users,DC=testDir,DC=Org", _

LoginInfo.Password, 0)

But I do not want to use ADSI. I am trying to use the DirectoryServices class. But the login fails when I try to use the same LDAP string as above.

DirectoryEntry
entry = new DirectoryEntry(LDAP, domainAndUsername, password);

What should be my LDAP string in the above Statement? The LDAP connection string used in the ADSI works but the same connection string fails when I try to use it through the DirectoryServices. The exact problem is as follows.

I need to search usernames on the root level. I can do that using ADSI. But the Directoryserves works only if I provide the child domain name. So why does that happen?

Thank you.

Answers (1)