473,386 Members | 1,715 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,386 software developers and data experts.

LDAP drill down organizationalUnit ASP.NET

I'm trying to create an ASP.NET page that will read over my active
directory tree and show the top level OrganizationalUnit values. From
there I want the user to be able to click on the top level and be able
to click on an OrganizationalUnit and have that return the sublevel
OrganizationalUnits. Basically a drill through that works like the AD
treeview, except on a webpage.

What is happening is that I get a list of the top level results,
example:

NorthAmerica
Canada
DistributionCenters

When I click on DistributionCenters I want it to drill into the levels
below it such as:

Houston
Seattle
Birmingham
BatonRouge
Lubbock

Instead the page is reloading the top level. I would expect that the
code:
DirectorySearcher adsiSearcher = new DirectorySearcher(
"LDAP://OU=NorthAmerica,DC=noam,DC=companyname,DC=com");
would filter down to the NorthAmerica Level and show the children since
it is getting passed into the Searcher. Not the case... any clues, or
advice? I'm 2 days into building this site, the details are complete I
just need an entry point with this page.
Here is what I have:

private void Page_Load(object sender, System.EventArgs e)
{

string qstring = Server.UrlDecode(Request.QueryString.ToString());

if(qstring.Equals(string.Empty))
{
qstring = "dc=companyname,dc=com";
}

DisplayResults(qstring);

}

private void DisplayResults(string searchString)
{
// DirectoryEntry adsiRoot = new DirectoryEntry( "LDAP://rootdse" );
// string sDefaultNamingContext = (string) adsiRoot.Properties[
"defaultNamingContext" ][0];
//
DirectorySearcher adsiSearcher = new DirectorySearcher( "LDAP://" +
searchString);
adsiSearcher.SearchScope = SearchScope.OneLevel;
adsiSearcher.CacheResults = false;
adsiSearcher.Filter = "(objectClass=organizationalUnit)";
adsiSearcher.PropertiesToLoad.Add( "Name" );
adsiSearcher.PropertiesToLoad.Add( "displayName" );
adsiSearcher.PropertiesToLoad.Add( "distinguishedName" );
adsiSearcher.PropertiesToLoad.Add( "objectCategory" );
SearchResultCollection adsiResult = adsiSearcher.FindAll();

string sOutput = "";

foreach(SearchResult result in adsiResult)
{
switch (result.Properties["objectCategory"][0].ToString())
{
case "CN=Person,CN=Schema,CN=Configuration,DC=companyna me,DC=com":
sOutput += "<a href='userdetail.aspx?" +
result.Properties["displayName"][0].ToString() + "' target='_blank'>" +
result.Properties["displayName"][0].ToString() + "</a><br>";
break;
case
"CN=Organizational-Unit,CN=Schema,CN=Configuration,DC=companyname,DC= com":
sOutput += "<a href='tryadsiviewer.aspx?" +
result.Properties["distinguishedName"][0].ToString() + "'
target='_blank'>" + result.Properties["Name"][0].ToString() +
"</a><br>";
break;

}
}

divOutput.InnerHtml = sOutput;
}

Nov 19 '05 #1
0 2588

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

Similar topics

0
by: paul b | last post by:
Hello, I am writing some LDAP-scripts in PHP. One of the scripts has to add new objects(urls) to the tree using the ldap_add command. The problem is that I cannot add objects of the type...
13
by: deepakp | last post by:
Hello, I need to display a summary report as an table, giving the user ability to drilldown on a selected row by clicking on a '+' icon. After viewing drilldown of a particular row, user should...
0
by: jpeters | last post by:
I am trying to create a crystal report in c# dotnet environment that allows the user to drill down. I have divided the report into groups and made them drillable. So for example the user can...
2
by: mrwoopey | last post by:
Hi, I need to be able to click onto a map and then drill down to a report. For example, could we have a map of the Chicagoland area with clickable areas (zip code) and when a user clicks on an...
0
by: adamz5 | last post by:
I am currently exporting a crystal report using code. This works fine and exports the report to a word document onto disk using DiskFileDestinationOptions() and ExportOptions However when i...
3
by: Naseem | last post by:
I am using CR in ASP.NET , I am able to show drill down graphs where grouping is done on single column from result set of sql query, is it possible to achieve drill down by grouping on multiple...
10
by: Cruelemort | last post by:
All, I am hoping someone would be able to help me with a problem. I have an LDAP server running on a linux box, this LDAP server contains a telephone list in various groupings, the ldif file of...
0
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have...
1
by: Bruno Marinho | last post by:
Hi, I'm having a problem creating an OU entry on a Open LDAP Server. I'm using the code below. $ad = ldap_connect("ldap://srvldap"); ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3); $bd =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.