Following is my code my requirement is after if my password is rpgls007 it should redirect to particular page else to other page when data is read from database,
con.Open();
string strQuery = "select * from empData where empid = @username and password = @password";SqlCommand cmd = new SqlCommand(strQuery);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@username", txtuser.Text.Trim());
cmd.Parameters.AddWithValue("@password", txtpassword.Text.Trim());
cmd.Connection = con;
dr = cmd.ExecuteReader();
if (dr.Read())
{
if (txtpassword.Text != "rpgls007")
{
Session["user"] = txtuser.Text;
Response.Redirect("user/user.aspx");
}
else
{
Session["user"] = txtuser.Text;
Response.Redirect("user/password.aspx");
}
}
else
{
lbl_msg.Text = "Incorrect User or Password";
resetPassword.Visible = true;
lbl_msg.Visible = true;
}

Posted May 21, 2016, 2:28 AM
Response.Redirect("user/user.aspx");
}
else
{
Session["user"] = txtuser.Text;
Response.Redirect("user/password.aspx");
}
Vipan SharmaPosted May 21, 2016, 12:35 AM
Ranjit PowarPosted May 20, 2016, 7:06 AM
Mufid BagdadiPosted May 20, 2016, 7:00 AM
Ranjit PowarPosted May 20, 2016, 6:58 AM