Ejemplo n.º 1
0
        public string Get()
        {
            var value = Context.Request.ReadCookie(_cookieName);

            if (!string.IsNullOrEmpty(value))
            {
                value = CookieUtilites.DecodeCookieValue(value);
            }
            return(value);
        }
Ejemplo n.º 2
0
        public void Set(string value)
        {
            if (value == null)
            {
                CookieUtilites.RemoveCookie(_cookieName);
                return;
            }

            value = CookieUtilites.EncodeCookieValue(value);

            if (_supportP3P)
            {
                Context.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
            }

            Context.Response.CreateCookie(new HttpCookie(_cookieName, value)
            {
                Expires  = GetExpirationDate(),
                HttpOnly = _httpOnly,
                Path     = ApplicationRootPath             // All cookies are root-pathed for now
            });
        }