Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DbLayer db = new DbLayer();

            String name    = tbRegName.Text;
            String id      = tbRegEmail.Text;
            String pwd     = tbRegPwd.Text;
            String country = tbDropCountry.Text;

            db.saveUser(name, id, pwd, country);

            Response.Cookies["user"].Value   = name;
            Response.Cookies["user"].Expires = DateTime.Now.AddDays(3);
            Response.Redirect("Login.aspx");
        }
Example #2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            DbLayer db  = new DbLayer();
            String  id  = tbLoginId.Text;
            String  pwd = tbLoginPwd.Text;

            if (!db.checkLogin(id, pwd))
            {
                string script = "alert(\"Try Again!\");";
                ScriptManager.RegisterStartupScript(this, GetType(),
                                                    "ServerControlScript", script, true);
            }
            else
            {
                Response.Cookies["user"].Value   = id;
                Response.Cookies["user"].Expires = DateTime.Now.AddDays(3);
                Response.Redirect("Default.aspx");
            }
        }