How can I retrieve salt from MySql database using Asp.Net ?
I want to use that retrieved salt to add to the user entered password to generate an SHA256 hash and then authenticate the user.
Here is what I am trying to do to fetch the salt:
String userNameEntered = UserN_TextBox.Text;
String passwordEntered = Password_TextBox.Text;
String connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
connection = new MySqlConnection(connectionString);
connection.Open();
MessageBox.Show("Successfully connected to database");
String queryString = "select salt from xyz.abc_table where salt = @Salt";
command = new MySqlCommand(queryString, connection);
command.Parameters.AddWithValue("@Salt", queryString);
reader = command.ExecuteReader();
Response.Write("Salt retrived is" + reader);
reader.Close();
connection.Close();
When I execute this code, it returns the MySql Data Reader library rather than the salt in the database....
Thanks in advance... :)