Exemple #1
0
        public static bool Login(string loginName, string pwd)
        {
            AdminUser adminUser = AdminUserRep.Login(loginName, pwd);

            if (adminUser == null)
            {
                return(false);
            }

            HttpContext.Current.Session["SyUserInfo"] = adminUser;
            HttpCookie cookie = new HttpCookie("SyUserInfo");

            cookie.HttpOnly = true;
            cookie.Values.Add("LoginName", AesHelper.Encrypt(adminUser.UserName));
            cookie.Values.Add("Password", AesHelper.Encrypt(adminUser.UserPwd));
            HttpContext.Current.Response.Cookies.Add(cookie);
            return(true);
        }