Esempio n. 1
0
        public ActionResult Login()
        {
            Session["error"] = null;
            string username = Request["username"];
            string password = Request["password"];

            List <Person> people = null;
            string        conStr = ConfigurationManager.ConnectionStrings["ConStrs"].ConnectionString;

            using (SqlConnection con = new SqlConnection(conStr))
            {
                con.Open();
                people = new AccessDB().Login_Check(username, password, con);;

                if (people.Any())
                {
                    Session["username"] = username;
                    Session["password"] = password;
                    return(RedirectToAction("Index", "HomeAsync", null));
                }
                else
                {
                    Session["error"] = "Invalid login";
                    return(RedirectToAction("RegisterForm", "ProfileAsync", null));
                }
            }
        }