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 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; }