how to read users information from active directory in asp.net application
Posted on 2009-05-17
i am writing a application in asp.net 2.0 to read the users from active directory.
but i am receiving error as : a referral was returned from the server in .net application
my code is:
Dim path As String = "LDAP://184.108.40.206/CN=Users,DC=firm,DC=domainname,DC=com"
Dim AD As DirectoryEntry = New DirectoryEntry(path)
AD.Username = "domainname\username"
AD.Password = "password"
Dim obj As DirectoryEntry
For Each obj In AD.Children
'Dim replaced As String = FixString(obj.Name.ToString(), "CN=", "")
Dim replaced As String = obj.Name.ToString()
'replaced = FixString(replaced, "\\", "")
Catch e As Exception
'MsgBox("Error is " & e.Message)