When using the System.DirecoryServices.DirectorySearcher how can you determine if a ClientTimeOut has occurred or that the search naturally returned an empty SearchResultCollection?
given the following snippet
using (var searcher = new DirectorySearcher(adRoot))
{
searcher.Filter = "SomeFilter";
searcher.PropertiesToLoad.Add("givenname");
searcher.PropertiesToLoad.Add("sn");
searcher.PropertiesToLoad.Add("department");
searcher.PropertiesToLoad.Add("samaccountname");
searcher.ClientTimeout = TimeSpan.FromSeconds(10);
using (var results = searcher.FindAll())
{
//haldle results
}
}
}