Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Multi Domain Active Directory Forest query in C#
Closed Thread
Old 01-11-2009, 12:26 PM   #1 (permalink)
 
Ultra Techie

Join Date: Feb 2004

Posts: 833

hygor

Default Multi Domain Active Directory Forest query in C#

Hiya,

I am trying to query an active directory setup (to retrieve user's details for an intranet system).

The active directory is set up as a multi domain forest in the following sort of structure:

.here
|
__________________________________________________ ___________
| | |
this.here (first domain in the AD forest) place.here .test.here
|
my.place.here

and so on...

I have been told by the client to connect to the GC server and run a query on .here which should allow the entire forest to be searched however I have tried querying the following

my c# code behind the user control contains the following:

lConnex = "LDAP://[SERVER]:[PORT]/DC=here";
lfilter = "(&(objectclass=user)(!(objectclass=computer)) )";

DirectoryEntry UsersTree = new DirectoryEntry(lConnex, "[UNAME]", "[PASS], AuthenticationTypes.None);

DirectorySearcher Searcher = new DirectorySearcher();
Searcher.SearchRoot = UsersTree;
Searcher.Filter = lfilter;
Searcher.SearchScope = SearchScope.Subtree;

SearchResultCollection Results = Searcher.FindAll();

I then run through the results and map details like first name and family name to a data table.

This gives me the following error:

Error Code 8007202B - "A referral was returned from the server"

I think this is to do with the multi-domain structure of the AD Forest as if I change the LDAP connection to: lConnex = "LDAP://[SERVER]:[PORT]/DC=this,DC=here"; I can retrieve a few users (but not those from the other domains).

I have also tried changing LDAP:// to GC:// but it makes no difference.

I am starting to go crazy now as I have been staring at this problem and going in circles for ages, any help would be greatly appreciated.

Thanks

Hygor
__________________

Last edited by hygor; 01-11-2009 at 05:29 PM. Reason: incorrect variable name typed - just correcting that!
hygor is offline  
Old 01-12-2009, 07:57 AM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Multi Domain Active Directory Forest query in C#

Quote:
Originally Posted by hygor View Post
I think this is to do with the multi-domain structure of the AD Forest as if I change the LDAP connection to: lConnex = "LDAP://[SERVER]:[PORT]/DC=this,DC=here"; I can retrieve a few users (but not those from the other domains).
i would try to find all the distinguished names in the forest. Then run separate queries.



edit:

this post from another forum describes searching gcs /multi domains. doesn't give an answer but describes some possibilites. that board could prolly answer more quickly.

Directory Programming .NET - Best Way to Handle Multiple Domains?

Last edited by office politics; 01-12-2009 at 12:27 PM.
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up active directory brad8266 Windows Operating Systems and Software 10 08-21-2008 04:12 PM
45 pop-ups in 3 hours!!! (W/ HJT Log) [P] MaXiMuS_N00BuS HijackThis Logs (finished) 11 06-23-2008 06:03 PM
Hijackthis Ship19 HijackThis Logs (finished) 18 05-22-2008 10:54 PM
active directory question davyo Computer Networking & Internet Access 4 11-04-2007 12:22 PM
Try out my new script programm! mssssee2 Windows Operating Systems and Software 11 07-20-2007 11:52 AM