コード例 #1
0
        /// <summary>
        /// 取Cookies值
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="key">键</param>
        /// <returns></returns>
        public static string Get(string name, string key)
        {
            string     _key         = "9cf8d21d394a8919d2f9706dfdc6421e";
            string     encryptName  = (_key + name).MD5();
            string     encryptKey   = (_key + key).MD5();
            string     decryptValue = string.Empty;
            HttpCookie cookie       = HttpContext.Current.Request.Cookies[encryptName];

            if (cookie.IsNotNull())
            {
                if (!string.IsNullOrEmpty(cookie.Values[encryptKey]))
                {
                    decryptValue = cookie.Values[encryptKey].ToString().AESDecode(_key);
                }
            }

            return(decryptValue.IsNullEmpty() ? string.Empty : decryptValue);
        }