如何设置 http headers 以便 ASP.NET Core 中不发生缓存?
How do I set http headers such that no caching occurs in ASP.NET Core?
我必须在我的 ASP.NET 核心 MVC 应用程序中设置 http headers,这样浏览器就不会缓存内容。我看看
How to clear browser cache in MVC application? 但它不适用于 .NET Core 平台。
我想在 .NET Core 中做在上面链接的 post 中标准 ASP.NET MVC 中所做的事情。
如果你想阻止浏览器缓存(包括 Internet Explorer 11),你可以用以下方式修饰你的方法或控制器class:
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
您可以在 .NET CORE 中阅读有关响应缓存的更多信息here。
我必须在我的 ASP.NET 核心 MVC 应用程序中设置 http headers,这样浏览器就不会缓存内容。我看看 How to clear browser cache in MVC application? 但它不适用于 .NET Core 平台。
我想在 .NET Core 中做在上面链接的 post 中标准 ASP.NET MVC 中所做的事情。
如果你想阻止浏览器缓存(包括 Internet Explorer 11),你可以用以下方式修饰你的方法或控制器class:
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
您可以在 .NET CORE 中阅读有关响应缓存的更多信息here。