Sono tornato a sbattere la testa al muro con l'autenticazione questa volta abilitando il formato della password come SHA1, faccio l'hashing della password ma quando vado a fare il login non mi riconosce, il web config è così configurato
codice:
<authentication mode="Forms">
<forms name="Authentication" loginUrl="~/login.aspx">
<credentials passwordFormat="SHA1">
<user name="utente1" password="D012F68144ED0F121D3CC330A17EEC528C2E7D59"/>
<user name="utente2" password="B3C8A9B5A8CA17D0B2A8E8540C196F21010A26E1"/>
</credentials>
</forms>
</authentication>
mentre il codice con cui genero l'hash ed eseguo il login è questo
codice:
...
protected string HashingPassword(string PasswordID)
{
_PasswordSHA1 = FormsAuthentication.HashPasswordForStoringInConfigFile(PasswordID, "SHA1");
return _PasswordSHA1;
}
protected void EseguiLogin()
{
string PasswordID = null;
if ((txtUser.Text != "") && (txtUser.Text != null) && (txtPassword.Text != "") && (txtPassword.Text != null))
{
_UserName = txtUser.Text;
PasswordID = txtPassword.Text;
HashingPassword(PasswordID);
if (FormsAuthentication.Authenticate(UserName, _PasswordSHA1))
{
LogInRiuscito();
}
else
{
txtUser.Text = "";
lblLogInBad.Text = "";
lblLogInBad.Text = "Username o Password incorretti!";
lblLogInBad.Visible = true;
}
...