Hi, Do the changes that marked in red in your code
protected void btnLogin_Click(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["ConStr"].ToString();
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand cmd = new SqlCommand("Usp_CheckLogin", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@userid", txtUserID.Text);
cmd.Parameters.AddWithValue("@password", txtPassword.Text);
cmd.Parameters.AddWithValue("@role", DDRole12.SelectedValue);
SqlDataReader sdr = cmd.ExecuteReader();
if (sdr.Read())
{ if (DDRole12.SelectedValue == "User") {
Response.Redirect("EmployeeProfile.aspx?empid=" + txtUserID.Text); }else { Response.Redirect("EmployeeView.aspx?empid=" + txtUserID.Text);
}
}
else
{
Response.Write("Your Login Unsuccessful");
}
sdr.Close();
con.Close();
} |