title: Change Password on next Logon for Forms Login with AdMembership providier
body: <p>I'm doing asp.net, using FormsAuthentication with the AdMembership proivder.</p>
  
  <p>I'm having to manually write a "change password on next logon" screen because it's not nativley supported in the provider.</p>
  
  <p>I call :</p>
  
  <pre><code>if (Membership.Provider.ChangePassword(cpCv.LoginName, cpCv.OldPassword, cpCv.NewPassword))
  </code></pre>
  
  <p>to validate the user and change the password (but not clear the "on next logon flag")</p>
  
  <p>But it always fails, 
  (I assume becasue membership validation fails when the "Change Password On Next Logon flag" is set.)</p>
  
  <p>What is the easiest way to validate the user, so I can be sure the "old password" and "username" match before resetting the password and clearing the "on next logon" flag?</p>
  
  <p>I've got the resetpassword and clear flag stuff working, it's the validation that's got me stuck.</p>
  
  <p>Also tried this code, If the Reset flag is false, it logs in, if true it fails to log in.</p>
  
  <pre><code>    DirectoryEntry de = new DirectoryEntry( path, "jcsn\\"+AdUserName, AdPassword );
  
      try
      {
          //Bind to the native AdsObject to force authentication.
          object obj = de.NativeObject;
  
          DirectorySearcher search = new DirectorySearcher( de );
  
          search.Filter = "(SAMAccountName=" + AdUserName + ")";
          search.PropertiesToLoad.Add( "cn" );
          SearchResult result = search.FindOne();
  
          if ( null == result )
          {
              return false;
          }
  
      }
      catch ( Exception ex )
      {
          throw new Exception( "Error authenticating user. " + ex.Message );
      }
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Eric-</p>