Exemplo n.º 1
0
        public ActionResult Cookies()
        {
            ViewBag.referrer = Request.UrlReferrer;

            var cookiePolicy = new CookiePolicyModel()
            {
                Essential = true
            };
            var cookie = System.Web.HttpContext.Current.Request.Cookies[CookieNames.COOKIE_POLICY];

            if (cookie != null)
            {
                cookiePolicy = JsonConvert.DeserializeObject <CookiePolicyModel>(cookie.Value, new JsonSerializerSettings()
                {
                    StringEscapeHandling = StringEscapeHandling.EscapeHtml
                });
            }
            return(View(cookiePolicy));
        }
Exemplo n.º 2
0
        private void SetRecruitmentBannerCookie()
        {
            var cookiePolicy       = new CookiePolicyModel();
            var cookiePolicyCookie = Request.Cookies[CookieNames.COOKIE_POLICY];

            if (cookiePolicyCookie != null)
            {
                cookiePolicy = JsonConvert.DeserializeObject <CookiePolicyModel>(cookiePolicyCookie.Value, new JsonSerializerSettings()
                {
                    StringEscapeHandling = StringEscapeHandling.EscapeHtml
                });
            }

            if (cookiePolicy.Settings)
            {
                HttpCookie cookie = new HttpCookie(CookieNames.SUPPRES_RECRUITMENT_BANNER, "yes");
                cookie.Expires  = DateTime.Now.AddDays(180);
                cookie.HttpOnly = false;
                cookie.Secure   = Request.IsSecureConnection;
                Response.Cookies.Add(cookie);
            }
        }