4,819 questions
Verify Passwords with BCrypt.net
MaartenMM
1
Reputation point
Hi all,
I'm having difficulties using the BCrypt-Offical NuGet package.
On my registration form the code I have to hash passwords is:
string Emailadres = txtEmail.Text;
string hashedPassword = BCrypt.Net.BCrypt.HashPassword(txtPaswoord.Text);
This code works fine and I can see that the passwords have been hashed in the database.
Code for login:
GipLogin_Business.Business.Controller cont = new GipLogin_Business.Business.Controller();
Session["Username"] = txtUsername.Text.Trim();
string test = cont.Paswoordinvoer(Session["Username"].ToString());
bool validPassword = BCrypt.Net.BCrypt.Verify(txtPassword.Text, test);
int count = cont.deLogin(txtUsername.Text, txtPassword.Text);
if (count == 1 && validPassword == false)
{
Session["Username"] = txtUsername.Text.Trim();
Response.Redirect("Dashboard.aspx");
}
else lblErrorMessage.Visible = true;
Validreason always return "false"
Any help would be great, thanks!
Maarten
Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | C#
11,573 questions
Sign in to answer