zoukankan      html  css  js  c++  java
  • 域账户密码登录验证

    https://files.cnblogs.com/files/shexunyu/%E5%9F%9F%E8%B4%A6%E6%88%B7%E5%AF%86%E7%A0%81%E7%99%BB%E5%BD%95%E9%AA%8C%E8%AF%81.zip

    public class VerifyUserByDomain
    {
      public static bool verify(string userName, string pwd, string domain)
      {
        bool boolResult = false;
      try
      {
        //连接域,path通常是:"LDAP://****";****为域的名字(一般是大写的英文字符串)
        DirectoryEntry dirEntry = new DirectoryEntry("LDAP://" + domain, userName, pwd);
        //string strFilter = "(&(objectCategory=person)(objectClass=user))";
        string strFilter = string.Format("(&(objectClass=user)(samAccountName={0}))", userName);
        DirectorySearcher objSearcher = new DirectorySearcher(dirEntry, strFilter);
        SearchResult result = objSearcher.FindOne();
        boolResult = true;
      }
      catch (Exception ex)
      {
        throw ex;
      }
        return boolResult;
      }
    }
  • 相关阅读:
    uva-11129-分治
    HDU 6016
    POJ 2142
    CodeForces 778B
    CodeFroces 758C
    HDU 5900
    HDU 5903
    HDU 5904
    POJ 3080
    HDU 5195
  • 原文地址:https://www.cnblogs.com/shexunyu/p/8426934.html
Copyright © 2011-2022 走看看