Hi George616,
You have to set on login button click.
protected void OnLogin(object sender, EventArgs e)
{
int userId = 0;
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT Uid FROM Users WHERE email = @Email AND pass = @Pass"))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim());
cmd.Parameters.AddWithValue("@Pass", txtPassword.Text.Trim());
cmd.Connection = con;
con.Open();
userId = Convert.ToInt32(cmd.ExecuteScalar());
con.Close();
}
}
if (userId > 0)
{
Session["user"] = userId;
Response.Redirect("MemberInvite.aspx");
}
else
{
Response.Redirect(Request.Url.AbsoluteUri);
}
}