起初请原谅我的英文,这不是我的母语。更改Active Directory密码
我正在开发一个管理Active Directory的Web平台。我可以创建,删除和编辑组,用户,OU等。
当连接的用户想要用平台更改自己的密码时,它会失败。
它来自DirectoryEntry.Invoke
。
我用DirectoryServices.DirectoryEntry
:
directoryEntry.Invoke("SetPassword", password);
directoryEntry.Commit();
所以,我想System.DirectoryServices.AccountManagement:
PrincipalContext ctx = new PrincipalContext(ContextType.Machine);
UserPrincipal user = UserPrincipal.FindByIdentity(ctx, Username);
user.SetPassword(password_);
user.Save();
不同的方式,同样的问题。
只有当用户试图编辑自己的密码时,它才会失败。
任何帮助将不胜感激。
可能重复[如何programaticly变更Active Directory密码(http://stackoverflow.com/questions/1066131/how-to-programaticly-change-active-directory-password) – JMax