Esempio n. 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        user      ac = new user();
        userDatum dm = new userDatum();

        dm.Email = TextTitle.Text;
        dm.Pass  = TextBox1.Text;
        DataTable dt = ac.Check_Login(dm);

        if (dt.Rows.Count > 0)
        {
            Response.Cookies.Add(new HttpCookie("Family_User", dt.Rows[0]["name"].ToString() + " " + dt.Rows[0]["family"].ToString()));
            Response.Cookies.Add(new HttpCookie("Email_User", TextTitle.Text));
            Response.Cookies.Add(new HttpCookie("Id_User", dt.Rows[0]["id"].ToString()));

            Response.Cookies.Add(new HttpCookie("Login_User", "True"));
            Label30.Visible      = false;
            Label1.Visible       = true;
            Login1.Visible       = false;
            ImageButton5.Visible = true;
            if (GridView1.Rows.Count <= 0)
            {
                ImageButton5.Visible = false;
                Label1.Visible       = false;
                Image6.Visible       = false;
            }
        }
        else
        {
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        dm.Email = TextTitle.Text;
        dm.Pass  = TextBox1.Text;
        DataTable dt = ac.Check_Login(dm);

        if (dt.Rows.Count > 0)
        {
            Response.Cookies.Add(new HttpCookie("Family_User", dt.Rows[0]["name"].ToString() + " " + dt.Rows[0]["family"].ToString()));
            Response.Cookies.Add(new HttpCookie("Email_User", TextTitle.Text));
            Response.Cookies.Add(new HttpCookie("Id_User", dt.Rows[0]["id"].ToString()));

            Response.Cookies.Add(new HttpCookie("Login_User", "True"));


            Response.Redirect(Request.RawUrl);
        }
        else
        {
            lblError.Visible = true;
        }
    }