Click to Rate and Give Feedback

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
 
Additional Search Options 

DirectorySearcher contains additional search options that you can add to an application to retrieve the best possible result set.

If the search does not yield results on the default server, then the server can return a referral for another server for the client to search. If referral chasing is set to All, then the client will query the server named in the referral. If set to None, then the client will not chase referrals. To set referral chasing, use the ReferralChasing property. The flags that can be used for ReferralChasing can be found in the ReferralChasingOption enumeration. The following code examples show how to set this property.

Visual Basic
Dim entry As New DirectoryEntry("LDAP://CN=computers,DC=buffalo,DC=corp,DC=fabrikam,DC=com")
Dim mySearcher As New DirectorySearcher(entry)
mySearcher.ReferralChasing = ReferralChasingOption.All
' Handle results.
' Handle errors.
C#
DirectoryEntry entry = new DirectoryEntry("LDAP://CN=computers,DC=buffalo,DC=corp,DC=fabrikam,DC=com");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.ReferralChasing = ReferralChasingOption.All;
// Handle results.
// Handle errors.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker