Hi guys, im doing a login page that will redirect users to a specific page based on their category. So far i can just only complete the normal login. It failed to run when i try to redirect users based on their category. My code are as below:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["LoginConStr"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select * from Users where Username =@username and Password=@password and Category=@category", con);
cmd.Parameters.AddWithValue("@username", Login1.UserName);
cmd.Parameters.AddWithValue("@password", Login1.Password);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
if ("@category".Equals("Artist"))
{
Response.Redirect("Artist.aspx");
}
else if ("@category".Equals("Buyer"))
{
Response.Redirect("Customer.aspx");
}
}
}