Esempio n. 1
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var messageEntries = _alarm.List().ToArray();

            if (messageEntries.Length == 0 && _existingEntries.Length == 0)
            {
                return;
            }

            _existingEntries = messageEntries.Concat(_existingEntries).ToArray();
            if (!(filterContext.Result is ViewResult || filterContext.Result is PageResult) && _existingEntries.Length > 0)
            {
                filterContext.HttpContext.Response.Cookies.Append(CookiePrefix, JsonConvert.SerializeObject(_existingEntries), new CookieOptions {
                    HttpOnly = true
                });
            }
        }