예제 #1
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");
            }
        }
예제 #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");
                }
            }
        }
예제 #3
0
 public NoCacheMiddleware(OwinMiddleware next, NoCacheOptions options)
     : base(next)
 {
     _options = options;
 }
예제 #4
0
 public NoCacheMiddleware(OwinMiddleware next, NoCacheOptions options)
     : base(next)
 {
     _options = options;
 }