【问题标题】:Detect if user must reset password In Active Directory检测用户是否必须在 Active Directory 中重置密码
【发布时间】:2012-04-29 14:08:23
【问题描述】:

我正在尝试检测用户是否必须在 Active Directory 中重置其密码。我正在使用用 C# 编写的控制台应用程序。

我正在尝试运行 GoDaddy 上的虚拟专用服务器

string strUserName = userName;
user = new DirectoryEntry("LDAP://0.0.0.0", "GodadyLogiUserInfo", "GodadyLogiUserPass", AuthenticationTypes.Secure);
DirectorySearcher searcher = new DirectorySearcher(user);

searcher.Filter = "(SAMAccountName=" + <USERWHICHNEEDTOTEST>+ ")";
searcher.CacheResults = false;

// Find user
SearchResult result = searcher.FindOne();
user = result.GetDirectoryEntry();

报错

服务器无法运行。

我在 SOF 和很多网站上尝试了很多方法,但都找不到。

【问题讨论】:

    标签: c# active-directory ldap


    【解决方案1】:

    LDAP://0.0.0.0 是供服务器监听的有效地址。它不是客户端尝试连接的有效地址。您必须提供正确的主机名或 IP 地址。

    【讨论】:

      【解决方案2】:

      试着像这样连接 AD:

      /* Connexion to Active Directory
       */
      string sFromWhere = "LDAP://ServerDnsName:389/dc=dom,dc=..";
      DirectoryEntry deBase = new DirectoryEntry(sFromWhere, "ADUser", "ADPwd");
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-12-06
        • 1970-01-01
        • 2014-09-10
        • 2010-09-28
        • 2020-06-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多