当我尝试Active Directory
通过调用方法更新用户密码时遇到错误
DirectoryEntry.Invoke("changepassword", object[]{oldPassword, newPassword})
新密码足够复杂,当新密码长度小于 时可以成功更新密码63(include 63)
,但是当新密码长度大于 时63
,出现错误。错误信息是:
Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirement of the domain.(Exception from HRESULT: 0x8007052D).
代码是:
public static void ChangePassword(DirectoryEntry user, string oldPassword, string newPassword)
{
oldPassword = (oldPassword == null) ? string.Empty : oldPassword;
newPassword = (newPassword == null) ? string.Empty : newPassword;
if (oldPassword != newPassword)
{
user.Invoke("ChangePassword", new object[] { oldPassword, newPassword });
}
}
我不知道为什么现在发生了,有人知道吗?谢谢你!