when open the login page it just displays user name is incorrect it seems to be bypassing the code.
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["regConnectionString"].ConnectionString);
conn.Open();
string checkuser = "select count(*) from users where username='" + usernametxt.Text + "'";
SqlCommand com = new SqlCommand(checkuser, conn);
int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
conn.Close();
if (temp == 1)
{
conn.Open();
string checkPasswordQuery = "select password from users where username = '" + usernametxt.Text + "'";
SqlCommand passComm = new SqlCommand(checkPasswordQuery, conn);
string password = passComm.ExecuteScalar().ToString().Replace(" ", "");
if(password == passwordtxt.Text)
{
Session["New"]= usernametxt.Text ;
Response.Write("password is correct");
}
else
{
Response.Write("password is not correct");
}
}
else
{
Response.Write("username is not correct");
}