Beispiel #1
0
 public void OnResourceExecuting(ResourceExecutingContext context)
 {
     // Global Settings
     {
         var clientVersion = context.HttpContext.Request.Headers["X-Global-Settings-Version"].FirstOrDefault();
         if (!string.IsNullOrWhiteSpace(clientVersion))
         {
             context.HttpContext.Response.Headers.Add("x-global-settings-version",
                                                      _globalSettings.IsFresh(clientVersion) ? Constants.Fresh : Constants.Stale);
         }
     }
 }
Beispiel #2
0
        public void OnResourceExecuting(ResourceExecutingContext context)
        {
            // Confirm their freshness of any global version headers supplied
            var cultureName = CultureInfo.CurrentUICulture.Name;
            // Translations
            {
                var clientVersion = context.HttpContext.Request.Headers["X-Translations-Version"].FirstOrDefault();
                if (!string.IsNullOrWhiteSpace(clientVersion))
                {
                    context.HttpContext.Response.Headers.Add("x-translations-version",
                                                             _factory.IsFresh(cultureName, clientVersion) ? Constants.Fresh : Constants.Stale);
                }
            }

            // Global Settings
            {
                var clientVersion = context.HttpContext.Request.Headers["X-Global-Settings-Version"].FirstOrDefault();
                if (!string.IsNullOrWhiteSpace(clientVersion))
                {
                    context.HttpContext.Response.Headers.Add("x-global-settings-version",
                                                             _globalSettings.IsFresh(clientVersion) ? Constants.Fresh : Constants.Stale);
                }
            }
        }