Пример #1
0
        /// <summary>
        /// 根据传过来的键值获取当前登录用户中的cookie信息
        /// </summary>
        /// <param name="keys"></param>
        /// <returns></returns>
        public List <string> GetLoginUserInfo(string[] keys)
        {
            var           loginUser = HttpContext.Current.Request.Cookies.Get("LoginUser");
            CryptManage   crypt     = new CryptManage();
            List <string> s         = new List <string>();

            foreach (string k in keys)
            {
                switch (k)
                {
                case CookieKeys.ID: s.Add(crypt.Decrypto(loginUser["ID"])); break;

                case CookieKeys.USERNAME: s.Add(HttpUtility.UrlDecode(loginUser["UserName"])); break;

                case CookieKeys.REGISTERNAME: s.Add(HttpUtility.UrlDecode(loginUser["RegisterName"])); break;

                case CookieKeys.USERDUTY: s.Add(HttpUtility.UrlDecode(loginUser["UserDuty"])); break;

                case CookieKeys.DEPARTMENTID: s.Add(crypt.Decrypto(loginUser["DepartmentID"])); break;

                case CookieKeys.PARENTDEPARTMENTID: s.Add(crypt.Decrypto(loginUser["ParentDepartmentID"])); break;

                case CookieKeys.USERGXID: s.Add(crypt.Decrypto(loginUser["UserGxID"])); break;

                case CookieKeys.USERROLES: s.Add(crypt.Decrypto(loginUser["UserRoles"])); break;

                case CookieKeys.USERROLENAMES: s.Add(HttpUtility.UrlDecode(loginUser["UserRoleNames"])); break;
                }
            }
            return(s);
        }
Пример #2
0
        /// <summary>
        /// 获得解密后的密码
        /// </summary>
        /// <param name="sPass"></param>
        /// <returns></returns>
        public string GetRealPass(string sPass)
        {
            CryptManage crypt = new CryptManage();

            return(crypt.Decrypto(sPass));
        }