|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Mar 2011
Messaggi: 1
|
[ASP.NET]Login Forms Authentication con SHA1
Buongiorno, ho un problema nell'eseguire un login abilitando il formato della password come SHA1 nel web.config, faccio l'hashing della password ma quando vado a fare il login non mi riconosce, il web config è così configurato
Codice:
<?xml version="1.0"?>
<!--
Per ulteriori informazioni su come configurare l'applicazione ASP.NET, visitare il sito Web all'indirizzo
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="~/Login.aspx">
<credentials passwordFormat = "SHA1">
<user name="utente1" password="D012F68144ED0F121D3CC330A17EEC528C2E7D59"/>
<user name="utente2" password="B3C8A9B5A8CA17D0B2A8E8540C196F21010A26E1"/>
</credentials>
</forms>
</authentication>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
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;
}
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 05:49.


















