Dear All,
I am saving hash password and sal password in db.
But when I trying to retrieve password, the password doesn't match. why. below is my code.
Creating User
protected
void
Create_User()
{
try
string
salt = GenerateSalt();
password = HashPassword(txtpassword.Text, salt);
SqlCommand com =
new
SqlCommand(
"Create_User"
, con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue(
"@User_Id"
, txtUserId.Text);
"@Password"
, password);
"@Salt_Password"
, salt);
"@Email"
, txtEmail.Text);
and when trying to login, it shows password did not match.
see code below
Do_Login()
SqlCommand com2 =
"select_Salt_Password"
com2.CommandType = CommandType.StoredProcedure;
com2.Parameters.Add(
, SqlDbType.NVarChar, 50).Value = ddl.SelectedItem.Text;
SqlDataAdapter da1 =
SqlDataAdapter(com2);
DataTable dt1 =
DataTable();
da1.Fill(dt1);
salt = dt1.Rows[0][
"Salt_Password"
].ToString();
password = HashPassword(txtPassword.Text, salt);
SqlCommand com11 =
"For_Login1"
com11.CommandType = CommandType.StoredProcedure;
com11.Parameters.AddWithValue(
, ddl.SelectedItem.Text);
SqlDataAdapter sda =
SqlDataAdapter(com11);
DataTable dtcheck =
sda.Fill(dtcheck);
if
(dtcheck.Rows.Count > 0)
}
else
{}
but still goes in else block. where I am making mistake?
Thanks