By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,526 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

HELP... LDAP/ DirectoryService Guru

P: n/a
Question 1...

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

DirectoryEntry(ConfigurationSettings.AppSettings(" strLDAP"))

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"
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}"
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!

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.