public override async Task Invoke(IOwinContext context)
        {
            _options = _options ?? new NoCacheOptions {NoEtag = false};

            context.Response.Headers.Add("Cache-Control",
                new[] {"no-store, no-cache, must-revalidate, proxy-revalidate"});
            context.Response.Headers.Add("Pragma", new[] {"no-cache"});
            context.Response.Headers.Add("Expires", new[] {"0"});

            await Next.Invoke(context);

            if (_options.NoEtag)
            {
                if (context.Response.Headers.ContainsKey("ETag"))
                    context.Response.Headers.Remove("ETag");
            }
        }
Example #2
0
        public override async Task Invoke(IOwinContext context)
        {
            _options = _options ?? new NoCacheOptions {
                NoEtag = false
            };

            context.Response.Headers.Add("Cache-Control", new[] { "no-store, no-cache, must-revalidate, proxy-revalidate" });
            context.Response.Headers.Add("Pragma", new[] { "no-cache" });
            context.Response.Headers.Add("Expires", new[] { "0" });

            await Next.Invoke(context);

            if (_options.NoEtag)
            {
                if (context.Response.Headers.ContainsKey("ETag"))
                {
                    context.Response.Headers.Remove("ETag");
                }
            }
        }
 public NoCacheMiddleware(OwinMiddleware next, NoCacheOptions options)
     : base(next)
 {
     _options = options;
 }
Example #4
0
 public NoCacheMiddleware(OwinMiddleware next, NoCacheOptions options)
     : base(next)
 {
     _options = options;
 }