DirectoryServices - LDAP problems...



Hi can someone please tell me why I can't put the following LDAP string into
my web.config fill as an <appSetting>

<add key="strLDAP" value="'LDAP://', 'Administrator',
'Password'" />

The connection string doesn't work when I call it in the code as shown


But this works fine if I put it straight into the code!
DirectoryEntry("LDAP://" & strADPath, "Administrator", "Password")

I don't get it... It is the same thing????

Question 2...

I have a datagrid and want to get a value from Active Directory and upload
it into a hyperlinkcolumn... but I can't get the value I need into the
DataNavigateURLField (See code!) Thanks!


<asp:hyperlinkcolumn DataNavigateUrlField="ADValueHere"
Text="<img border=0 src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>

Sub GetUserADInfo()
Dim strADPath As String

strADPath = ""

Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "Administrator", "Password")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=user))")
'Dim MySearchResult As SearchResult = mySearcher.FindOne
Dim results As SearchResultCollection
results = mySearcher.FindAll()
dgADUserInfo.DataSource = results

End Sub

Can someone please help!


Expand AllCollapse All

Manage Your Profile |Legal |Contact Us |MSDN Flash Newsletter
©2005 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks
|Privacy Statement


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