hi, i m trying to make something like a login page and i used the following code to compare the Users password from a password text box and then compare it with the Database password to see if it is the same. nevertheless when i compare the strings the system doesnt accept them as the same and i cant login.(i also tried the String.Compare but i get the same resuly). Any help please?
Code:String username = txtusername.Text;
String password = txtpass.Text;
String connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select password from Details WHERE username='" + username + "';";
Console.WriteLine(cmd.CommandText);
conn.Open();
String pass = cmd.ExecuteScalar().ToString();
conn.Close();
Label2.Text = pass;
Label3.Text = password;
if (pass==password)
{
Response.Redirect("logedin.aspx");
}

