Using ASP.Net to Get User Information from AD

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
 
B

billmiami2

Try

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

Bill E.
Hollywood, FL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top