Just why... does Active Directory validate the last password?http://forums.asp.net/t/1761117.aspx/1?Just+why+does+Active+Directory+validate+the+last+password+Mon, 23 Jan 2012 14:58:51 -050017611174794202http://forums.asp.net/p/1761117/4794202.aspx/1?Just+why+does+Active+Directory+validate+the+last+password+Just why... does Active Directory validate the last password? <p>Hi there,</p> <p>I am working on a simple solution to update a user's password in Active Directory.</p> <p>I can successfully update the users password. Updating the password works fine. Lets say the user has updated the password from <em>MyPass1</em> to <strong><em>MyPass2</em></strong></p> <p>Now when <em></em>I run my custom code to validate users credential using:</p> <pre class="prettyprint">using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, &quot;TheDomain&quot;)) { // validate the credentials bool isValid = pc.ValidateCredentials(&quot;myuser&quot;, &quot;<strong><em>MyPass2</em></strong>&quot;); } //returns true - which is good</pre> <p>Now when I enter some wrong password it validates very nicely:</p> <pre class="prettyprint">using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, "TheDomain")) { // validate the credentials bool isValid = pc.ValidateCredentials("myuser", "<strong>wrongPass</strong>"); }<br /><br />//returns false - which is good</pre> <p>Now for odd reasons, it validates the previous last password which was MyPass1 remember?</p> <pre class="prettyprint">using(PrincipalContext pc = new PrincipalContext(ContextType.Domain, "TheDomain")) { // validate the credentials bool isValid = pc.ValidateCredentials("myuser", "<strong><em>MyPass1</em></strong>"); }<br /><br />//returns <span style="text-decoration: underline;">true</span> - but why? we have updated password to Mypass2<br /><br /></pre> <p>I got this code from</p> <p>http://stackoverflow.com/questions/290548/c-sharp-validate-a-username-and-password-against-active-directory</p> <p>Guys, any thoughts on this...... Is it something to do with last password expiry or is this how the validation supposed to work</p> <p>Kindly reply... Any inputs would be greatly appreciated :)</p> <p>Cheers!</p> 2012-01-20T22:41:59-05:004794968http://forums.asp.net/p/1761117/4794968.aspx/1?Re+Just+why+does+Active+Directory+validate+the+last+password+Re: Just why... does Active Directory validate the last password? <p>I dont use directoryservices myself but I have seen that when it is used it appears to work with a cached copy of the user's information and any changes takes time to update in the application.</p> 2012-01-21T19:16:23-05:004795038http://forums.asp.net/p/1761117/4795038.aspx/1?Re+Just+why+does+Active+Directory+validate+the+last+password+Re: Just why... does Active Directory validate the last password? <p>Hi there...</p> <p style="padding-left:30px">Thanks for your. How can we clear the cached copy?</p> <p style="padding-left:30px">Please reply.</p> 2012-01-22T00:12:46-05:004796988http://forums.asp.net/p/1761117/4796988.aspx/1?Re+Just+why+does+Active+Directory+validate+the+last+password+Re: Just why... does Active Directory validate the last password? <p>I am not sure if there is a way without restarting the web in IIS or waiting for it to replicate from AD. Had a guy where I work trying to use directoryservices for an application and had the same issue. If you want to test that try using the code here, <a href="http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C"> http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C</a>&nbsp;and see if you can authenticate the user using the code there.</p> 2012-01-23T14:58:51-05:00