Cannot set password for AD User

K

Kodiak

I create a DirectoryEntry object called userEntry and I am calling the
Invoke method. I am calling the SetPassword method and passing the
new password and I am using the DirectoryServices namespace in my
code. The problem that I an experiencing is everytime I call the
SetPassword method I get an exception called Login Failure: unknown
username and password. I have checked the account I am using to use
to authenticate to AD and the account is not disabled or locked out
and the password does not need to be changed on the next login. I am
using secure mode to connect to AD and I can create the AD account
without any problems, but when I set the password I always get an
error. I really do not want to use impersonation as a solution so any
advice you can provide me is much appreciated.

Thanks,
Richard
 
G

Guest

you are probaly best asking AD question to 'Joe' in the
microsoft.public.adsi.general newsgroup,

but here is the code I used:

private void ChangePassword(System.DirectoryServices.DirectoryEntry entry,
string oldPassword, string newPassword)
{
object[] pwd = newobject[] {oldPassword, newPassword};
entry.Invoke("ChangePassword", pwd); //Commit the changes back into
directory
service entry.CommitChanges();
entry.RefreshCache();
}

check out the following url

http://osdir.com/ml/windows.devel.dotnet.advanced/2003-06/msg00079.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top