当我尝试通过调用方法从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 });
}
}
我不知道为什么现在发生了,有人知道吗?谢谢!