, ( ), , .
( asp net):
1. web.config, // :
enablePasswordRetrieval="true"<br/>
passwordFormat="Encrypted"
:
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="maindb"
enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" passwordFormat="Encrypted" />
</providers>
</membership>
2. validationKey decryptionKey. NET API:
:
public static class RNGCrypto_MachineKey
{
public static string getRandomKey(int bytelength)
{
byte[] buff = new byte[bytelength];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
rng.GetBytes(buff);
StringBuilder sb = new StringBuilder(bytelength * 2);
for (int i = 0; i < buff.Length; i++)
sb.Append(string.Format("{0:X2}", buff[i]));
return sb.ToString();
}
}
:
string key64 = RNGCrypto_MachineKey.getRandomKey(64);
string key32 = RNGCrypto_MachineKey.getRandomKey(32);
3.Again, web.config system.web:
<machineKey validationKey="paste here the key64 string" decryptionKey="paste here the key32 string" validation="SHA1"/>
( machinkey msdn)
4. , :
Membership.GetUser(username).GetPassword();