I am trying to search a user object that is located in a domain that is
sub-ordinate to the one from where I begin my search. For eg. I have the
domains as DC=corp,DC=company,DC=com and DC=dept1,DC=corp,DC=company,DC=com
I use the following code:
DirectoryEntry rootDNC = new
DirectoryEntry("LDAP://DC=corp,DC=company,DC=com" );
DirectorySearcher searcher = new DirectorySearcher(rootDNC);
searcher.Filter = "(&(objectCategory=Person)(sAMAccountName=testuser ))";
searcher.SearchScope = SearchScope.Subtree;
searcher.ReferralChasing = ReferralChasingOption.Subordinate;
SearchResultCollection rC = searcher.FindAll();
The "testuser" is a user object in the child domain. Now after the FindAll
call if I attempt to examine the rC (result collection) it throws an
exception saying "a referral was returned from server".
How do I access the referral and use it to continue my search as I dont see
any method/property in result collection to do that.
I dont specify/set ReferralChasing property on the searcher I get 0 results.
Any help/pointers would be appreciated.
TIA, Jay