Пример #1
0
        protected virtual bool LoadFromSession(IPlatSessionData session)
        {
            var obj = HttpContext.Current.Session[PlatCookieName];

            if (null == obj)
            {
                return(false);
            }
            string value = obj.ToString();

            return(session.FromPlatString(value, (int)EnumPlatSessionMode.Session));
        }
Пример #2
0
        protected virtual bool LoadFromCookie(IPlatSessionData session)
        {
            HttpCookie obj = null;

            string[] keys = HttpContext.Current.Response.Cookies.AllKeys;
            if (null != keys && keys.Contains(PlatCookieName))
            {
                obj = HttpContext.Current.Response.Cookies[PlatCookieName];
            }
            if (null == obj || string.IsNullOrEmpty(obj.Value))
            {
                obj = HttpContext.Current.Request.Cookies[PlatCookieName];
            }
            if (null == obj || string.IsNullOrEmpty(obj.Value))
            {
                return(false);
            }
            string value = CryptoUtil.FromBase64(obj.Value);

            return(session.FromPlatString(value, (int)EnumPlatSessionMode.Cookie));
        }