示例#1
0
        protected void BTNSubmitLogin_Click(object sender, EventArgs e)
        {
            List <Validazione> validLogin = new List <Validazione>();

            for (int i = 0; i < 5; i++)
            {
                var    v       = new Validazione();
                string newUser = "******" + i;
                string newPsw  = "psw" + i;
                v.setUser(newUser);
                v.setPSW(newPsw);
                validLogin.Add(v);
            }

            //bool userFound = false;
            bool isLogged = false;

            foreach (Validazione v in validLogin)
            {
                if (v.getUser() == userID.Text && v.getPSW() == pswID.Text)
                {
                    isLogged = true;
                    Session["currentUser"] = v.getUser();
                    Session["currentPsw"]  = v.getPSW();
                    Session["logged"]      = isLogged;

                    //LBLOutLogin.Text = "login corretto";
                    Response.Redirect("Import.aspx", true);
                    //userFound = true;
                    break;
                }

                LBLOutLogin.Text = "login errato";
                Response.Redirect("forbidden.html", true);
            }

            /*
             * if (!userFound)
             * {
             *  LBLOutLogin.Text = "login errato";
             * }
             */
        }
示例#2
0
        protected void BTNSubmitLogin_Click(object sender, EventArgs e)
        {
            var v = new Validazione();

            if (userID.Text == v.getUser() && pswID.Text == v.getPSW())
            {
                LBLOutLogin.Text = "login corretto";
            }
            else
            {
                LBLOutLogin.Text = "login errato";
            }
        }