Using ASP.Net to Get User Information from AD

  • Thread starter Thread starter Derek Martin
  • Start date Start date
D

Derek Martin

(Sorry, cross posted on accident)

Hey list, got this code running in a webform:

Dim DSESearcher As System.DirectoryServices.DirectorySearcher = New
System.DirectoryServices.DirectorySearcher
Dim RootDSE As String = DSESearcher.SearchRoot.Path
RootDSE = RootDSE.Insert(7, "ou=users,ou=myusers,")
Dim myDE As DirectoryEntry = New DirectoryEntry(RootDSE)
Dim myEntries As DirectoryEntries = myDE.Children
Dim thisentry As DirectoryEntry
thisentry = myEntries.Find("cn=" & lastname)
Label1.Text = thisentry.Name

Obviously, this won't work because it's running as the ASP.Net user. How do
I go about getting another or hardcoded user to authenticate with
DSESearcher?

Thanks!
Derek
 
Try

Dim myDE As DirectoryEntry = New DirectoryEntry(strLDAPPath,
strUserName, strPassword,
System.DirectoryServices.AuthenticationTypes.Secure)

Bill E.
Hollywood, FL
 
Back
Top