csharp 无缓存操作筛选器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 无缓存操作筛选器相关的知识,希望对你有一定的参考价值。
public class NoCacheAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
base.OnActionExecuted(actionExecutedContext);
if (actionExecutedContext.Response.IsSuccessStatusCode)
{
var cc = new System.Net.Http.Headers.CacheControlHeaderValue();
cc.NoStore = true;
cc.NoCache = true;
cc.Private = true;
cc.MaxAge = TimeSpan.Zero;
actionExecutedContext.Response.Headers.CacheControl = cc;
}
}
}
以上是关于csharp 无缓存操作筛选器的主要内容,如果未能解决你的问题,请参考以下文章