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
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