



























public class AD_pass
{
private string _path;
private string _filterAttribute;public AD_pass()
{ _path
= "LDAP://DC=office,DC=local"; }
public bool IsAuthenticated(string username, string pwd)
{ try
{
DirectoryEntry entry
= new DirectoryEntry(_path, username, pwd); Object obj
= entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
_path = result.Path;
_filterAttribute = (String)result.Properties["cn"][0];
}
catch (Exception ex)
{
return false;
}
return true;
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。