Hi
I got an issue when I user Directory Service to change passwod.
here is the code:
try
{
string conString = string.Format("WinNT://{0}/{1}",ServerName, UserName);
DirectoryEntry de = new DirectoryEntry(conString);
de.Invoke("ChangePassword", new object[] {PasswordCurrent, PasswordNew });
de.CommitChanges();
return String.Empty;
}
catch (Exception ex)
{
return ex.InnerException.Message;
}
The problem is that I really used the right old passowd to change password,but It throw an Exception with message "The specified network password is not corrent."
BTW,My PC is in a domain,and I'm trying to change the password of local administrator with this code. the logged account is an domain account in Local Administrators Group.
I googled this message,and have ever set Local security and modified LSA node in registry by googled solutions,but with no lucky for this issue.
then I tried "SetPassword" instead.It Work OK. but I don't know why.
I doubt there is some tricks for the use of these two methods.
for your reference:
http://msmvps.com/blogs/alunj/archive/2006/11/07/ChangePassword-versus-SetPassword.aspx[
^]
I did't got the reason why the method Changepassord didn't work.
Thanks, Any reply is appreciated.