解决方法
您可以使用自定义无缓存操作筛选器:
public class NoCacheAttribute : ActionFilterAttribute { public override void OnResultExecuting(ResultExecutingContext filterContext) { var cache = filterContext.HttpContext.Response.Cache; cache.SetExpires(DateTime.UtcNow.AddDays(-1)); cache.SetValidUntilExpires(false); cache.SetRevalidation(HttpCacheRevalidation.AllCaches); cache.SetCacheability(HttpCacheability.NoCache); cache.SetNoStore(); base.OnResultExecuting(filterContext); } }
然后使用您不希望被客户端浏览器缓存的此属性装饰任何控制器/操作.