I am using vb.net and the following code, but I am getting an error. I am new to vb.net and Active Directory, pls help me to solve this problem.
My code:
Dim dirEntry As DirectoryEntry = New DirectoryEntry()
dirEntry.Path = "ldap://sunbs.in:389/CN=Schema,CN=Configuration,DC=sunbs,DC=in"
dirEntry.Username = "sunbs.in\sbsldap"
dirEntry.Password = "sbs@123"
Dim searcher As New DirectorySearcher
searcher.SearchRoot = dirEntry
When I debug the code the I get error in 2nd line. unknown error(0X80005000)
Try to use an UPPERCASE LDAP://
prefix for your dirEntry.Path
:
Dim dirEntry As DirectoryEntry = New DirectoryEntry()
' use LDAP:// - not ldap://
dirEntry.Path = "LDAP://sunbs.in:389/CN=Schema,CN=Configuration,DC=sunbs,DC=in"
dirEntry.Username = "sunbs.in\sbsldap"
dirEntry.Password = "sbs@123"
Dim searcher As New DirectorySearcher
searcher.SearchRoot = dirEntry
User contributions licensed under CC BY-SA 3.0