2

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)

0

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

2 Comments

thank u so much for ur reply. how to check whether particular user exists in active directory
@sudha.s: that's a whole new question - please post a new question so we can answer ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.