I have a website of which I am migrating membership from aspnet services to a custom provider. I would like to migrate existing users without them needing to change their passwords.
The users passwords are currently stored using a one-way encryption. The only option for me is to use the same salt and passwords that asp services and validate against them with my custom provider.
Here is the configuration used to currently hash the passwords with aspnet services.
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">
<providers>
<clear/>
<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"/>
</providers>
</membership>
I have been pulling my hair out trying to wright the code needed to validate passwords against hashes generated by this config.
This is what I got so far. Any help would be greatly appreciated.
private static string CreatePasswordHash(string Password, string Salt)
{
return FormsAuthentication.HashPasswordForStoringInConfigFile(Password + Salt, "SHA1");
}