DirectoryServices - LDAP problems...

G

Guest

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

<appSettings>
<add key="strLDAP" value="'LDAP://doamin.domain.com', 'Administrator',
'Password'" />
</appSettings>

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

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!

...Code

<asp:hyperlinkcolumn DataNavigateUrlField="ADValueHere"
DataNavigateUrlFormatString="usrManDetails.aspx?id={0}"
Text="<img border=0 src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>


...CodeBehind
Sub GetUserADInfo()
Dim strADPath As String

strADPath = "domain.domain.com"

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
dgADUserInfo.DataBind()

End Sub


Can someone please help!

Thanks



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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top