title: How can I validate hashed ASP.NET service passwords programmatically?
body: <p>I have a website in which I am migrating membership from ASP.NET services to a custom provider. I would like to migrate existing users without them needing to change their passwords.</p>
  
  <p>The users' passwords are currently stored using a one-way encryption. The only option for me is to use the same salt and passwords as the ASP services and validate against them with my custom provider.</p>
  
  <p>Here is the configuration used to currently hash the passwords with ASP.NET services.</p>
  
  <pre><code>&lt;membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType=""&gt;
          &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add connectionStringName="dashCommerce" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="dashCommerce" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
          &lt;/providers&gt;
  &lt;/membership&gt;
  </code></pre>
  
  <p>I have been pulling my hair out trying to write the code needed to validate passwords against hashes generated by this config.</p>
  
  <p>This is what I have so far. Any help would be greatly appreciated.</p>
  
  <pre><code>private static string CreatePasswordHash(string Password, string Salt)
  {
      return FormsAuthentication.HashPasswordForStoringInConfigFile(Password + Salt, "SHA1");
  }
  </code></pre>