0

我已经编写了以下代码来搜索目录,但Searcher.FindOne();出现异常[Unknown error (0x80005000)]

bool Success = false;

System.DirectoryServices.DirectoryEntry Entry = 
   new System.DirectoryServices.DirectoryEntry("LDAP://" + Domain, Username, Password);

System.DirectoryServices.DirectorySearcher Searcher = 
   new System.DirectoryServices.DirectorySearcher(Entry);

Searcher.SearchScope = System.DirectoryServices.SearchScope.OneLevel;
try
{
     System.DirectoryServices.SearchResult Results = Searcher.FindOne();
     Success = (Results != null);
}
catch
{
     Success = false;
}
return Success;
4

0 回答 0