Esempio n. 1
0
        /// <summary>
        /// 读取指定Cookie解密
        /// </summary>
        /// <param name="name"></param>
        public static string GetCookie(string name)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(name);

            if (cookie == null)
            {
                return(null);
            }
            return(MFEncryptUtil.DecryptDES(cookie.Value, MFEncryptUtil.KeyDES));
        }
Esempio n. 2
0
        /// <summary>
        /// 写入指定Cookie加密
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public static void SetCookie(string name, string value)
        {
            if (value == null)
            {
                return;
            }
            HttpCookie cookie = new HttpCookie(name, MFEncryptUtil.EncryptDES(value, MFEncryptUtil.KeyDES));

            //cookie.Path = "/";
            HttpContext.Current.Response.Cookies.Add(cookie);
        }