Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cookiekey"></param>
        /// <returns></returns>
        public static string GetCookie3Des(string cookiekey)
        {
            string cookyval = GetCookie(cookiekey);

            if (!String.IsNullOrEmpty(cookiekey))
            {
                cookyval = SafeSecurity.DecryptDES(cookyval, Des3Key);
            }
            return(cookyval);
        }
Example #2
0
        public static string ReadCode(string cookieName)
        {
            string result = string.Empty;
            string des    = CookieHelper.GetCookie(cookieName);

            if (!string.IsNullOrEmpty(des))
            {
                string   val     = SafeSecurity.DecryptDES(des, DesKey);
                string[] vallist = val.Split('_');
                if (vallist.Length == 4)
                {
                    string ip   = HttpContext.Current.Request.UserHostAddress;
                    var    time = vallist[3].ToT <DateTime>(DateTime.Now.AddDays(-1));
                    if (ip == vallist[1] && time > DateTime.Now)
                    {
                        result = vallist[2];
                    }
                }
            }
            CookieHelper.RemoveCookie(cookieName);
            return(result);
        }