protected void OnValidateUser(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(connection);
SqlCommand cmd = new SqlCommand(String.Format("Select * from Users where userName ='{0}' and password='{1}'", txtUserID.Text.Trim(), txtPassword.Text.Trim()), con);
con.Open();
SqlDataReader idr = cmd.ExecuteReader();
userinfo user = new userinfo();
if (idr.Read())
{
Session["UserId"] = idr["userId"];
Session["UserName"] = idr["Username"];
Response.Redirect("View-Info.aspx");
}
else
{
lblerror.Text = "Error : Please enter currect user name and password !";
}
}
public class userinfo
{
public int userId { get; set; }
public string userName { get; set; }
public string password { get; set; }
public string role { get; set; }
}