Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["log"] != null)
     {
         //get Session
         LoginLog log = (LoginLog)Session["log"];
         user = log.username;
     }
     else
     {
         Response.Redirect("Page1.aspx");
     }
 }
        protected void btnLogin_click(object sender, EventArgs e)
        {
            string[] user = { "admin", "123456" };

            if (txtUsername.Value.Equals(user[0]) && txtPassword.Value.Equals(user[1]))
            {
                invalidStatus = false;

                //create Session
                LoginLog user1 = new LoginLog(txtUsername.Value, txtPassword.Value);
                Session["log"] = user1;

                Response.Redirect("index.aspx");
            }
            else
            {
                invalidStatus = true;
            }
        }