使用DirectorySearcher时发生操作错误

时间:2014-04-02 13:30:28

标签: c# asp.net

我遇到了这个错误:

  

发生操作错误

此处发生错误:

SearchResult findUser = searcher.FindOne();

完整代码:

DirectorySearcher searcher = new DirectorySearcher();

searcher.SearchScope = SearchScope.Subtree;
string UserName = Page.User.Identity.Name;
searcher.Filter = string.Format(CultureInfo.InvariantCulture, 
                                "(sAMAccountName={0})", UserName);

SearchResult findUser = searcher.FindOne();

0 个答案:

没有答案