mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
20 lines
665 B
C#
20 lines
665 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
namespace MusicStore.Infrastructure
|
|
{
|
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
|
public sealed class NoCacheAttribute : ActionFilterAttribute
|
|
{
|
|
public override void OnResultExecuting(ResultExecutingContext context)
|
|
{
|
|
context.HttpContext.Response.Headers["Cache-Control"] = "no-cache, no-store, max-age=0";
|
|
context.HttpContext.Response.Headers["Pragma"] = "no-cache";
|
|
context.HttpContext.Response.Headers["Expires"] = "-1";
|
|
|
|
base.OnResultExecuting(context);
|
|
}
|
|
}
|
|
}
|