473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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>

<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

Nov 19 '05 #1
0 949

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Moore | last post by:
Hello I posted a thread about this a while back, but I can't actually find it again so I can reply to it with the solution I found, so I'm making a new thread and hoping it goes to the top of...
0
by: Keith Jakobs, MCP | last post by:
Greetings: Ok, I know the .NET framework is supposed to make things easier, but at this point, I am rapidly getting the impression that .NET stinks compared to ADSI when it comes to interfacing...
12
by: hykim | last post by:
Hello, everyone. according to MSDN, there is any constructor of System.DirectoryServices.SearchResultCollection Class. if I implement DirectorySearcher.FindAll() method by myself, then how can I...
4
by: m96 | last post by:
hi, i'm trying to make a query to a ldap server (version v2 or v3 doen't matter) with c#. the query works just fine but the problem is that i can't read the custom attributes/fields, since .net...
3
by: Chad Beckner | last post by:
I am starting to translate some code from ASP to ASP.NET (VB). I was able to query ADS to get a users groups that they belong to, and also query a group and get a list of users. However, I can't...
5
by: Keith Jakobs, MCP | last post by:
Hi All.... I'm having a HECK of a time connecting to Active Directory using VB in Visual Studio.NET 2003. Can anyone PLEASE help me? All I am trying to do is list the current members of our...
0
by: RSH | last post by:
I am using System.DirectoryServices to query our AD in order to get information about users. I am having problems understanding how to get at the Username and the Email address (to begin with) ...
6
by: Mark Rae | last post by:
Hi, I'm in the process of updating an ASP.NET v1.1 web app to v2. The app uses ActiveDirectory a great deal, and I'm trying to use the new System.Collections.Generic namespace where possible,...
6
by: bugnthecode | last post by:
Hi, I'm building a small desktop app in VS Std 2005 with C# and .net 2.0. I've managed to get the code together to query the ldap my company has, but every time I attempt to access a specific...
4
by: jmDesktop | last post by:
Can someone tell me why I get this error? System.DirectoryServices.DirectoryServicesCOMException was unhandled Message="An operations error occurred.\r\n" Source="System.DirectoryServices"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.