【问题标题】:ADAM user's password reset with c#使用 c# 重置 ADAM 用户的密码
【发布时间】:2013-08-30 06:16:23
【问题描述】:

我正在尝试在 ADAM 中重置用户密码。为此,我正在使用 Accountmanagement 命名空间

我尝试了什么:

PrincipalContext rootPrincipalContext;
LdapConnection objLdapconnection;
rootPrincipalContext = new PrincipalContext(ContextType.ApplicationDirectory, host, baseDN, ContextOptions.Negotiate, username, password);
LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier(host, Convert.ToInt32(port));
NetworkCredential credential = new NetworkCredential(username, password);
LdapConnection ldapCon = new LdapConnection(identifier, credential);
ldapCon.AuthType = AuthType.Negotiate;
objLdapconnection = ldapCon;

密码重置:

 UserPrincipal existingUsr = UserPrincipal.FindByIdentity(rootPrincipalContext, IdentityType.DistinguishedName, "cn=" + inputName + ",ou=gslab,dc=starfish");

existingUsr.SetPassword(userPassvalue); this lines throws exception "directory property can not be found"

我检查了没有一个字符串是空的,也尝试了 contextOption.secureSocketlayer 但没有任何效果

我需要提供加密密码吗?还是我需要设置任何属性?提前致谢。

【问题讨论】:

    标签: active-directory ldap ldap-query adam


    【解决方案1】:

    好吧,我得到了解决方案。只需删除

    ContextOptions.Negotiate 
    

    在实例化rootprincipalContext时。

    并在SetPassword()之前使用ExpirePasswordNow()方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-05
      • 1970-01-01
      • 2023-03-30
      • 2015-08-04
      • 1970-01-01
      • 2023-02-08
      • 1970-01-01
      相关资源
      最近更新 更多