Re: Changing a directory entry password in C#, something strange?

From: O.P. Lichter (bordev_at_hotmail.com)
Date: 06/16/03


Date: 16 Jun 2003 07:55:55 -0700


I got the same problem, I wrote a vb.Net service that must be capable
of changing user's passwords. The only way to release the
password-cache seems to be restarting the service/process, which
ofcourse I don't want :-(

"Ollie" <ollie_riches@hotmail.com> wrote in message news:<OHO9E6mLDHA.304@tk2msftngp13.phx.gbl>...
> The only solution I have come up with yet is to do an 'IISReset' every
> hour....
>
> Ollie
>
> <ooo> wrote in message news:u08CTqeLDHA.2480@TK2MSFTNGP10.phx.gbl...
> > I am invoking the 'ChangePassword' method on the DirectoryEntry object for
> a
> > user, this successfully changes the passsword for the user and I can login
> > with the new password, BUT the old password is also valid so I can login
> > with either the new or old password until the win32 process has been
> > shutdown. It appears the changes are not getting flushed into the AD
> > correctly....
> >
> > Has anyone else seen this?
> >
> > Has anyone got a solution?
> >
> > I have tried turning off property caching using the 'UsePropertyCache'
> > property and then reloading the properties using the 'RefreshCache' method
> > but this did not help.
> >
> > The code used to reset the password is shown below:-
> >
> > private void ChangePassword(System.DirectoryServices.DirectoryEntry entry,
> > string oldPassword, string newPassword)
> > {
> > object[] pwd = new object[] {oldPassword, newPassword};
> > entry.Invoke("ChangePassword", pwd);
> > //Commit the changes back into directory service
> > entry.CommitChanges();
> > entry.RefreshCache();
> > }
> >
> > Cheers in Advance
> >
> > Ollie
> >
> >



Relevant Pages


Quantcast