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");
}
}
}
Can you guys tell me where is my error and how should i modify it?
P.S: Sorry i can only copy my code since i dont know how to paste the code in lines like the others do.
P.S: Sorry i can only copy my code since i dont know how to paste the code in lines like the others do.
Nilesh ShahPosted Nov 20, 2017, 8:40 AM