开发者

How to disable Browser Caching for a specific View in ASP.NET MVC Environment?

开发者 https://www.devze.com 2022-12-14 14:30 出处:网络
I want to disable Browser Caching in a specific View. I tried Response.Cache.SetCacheability(HttpCacheability.NoCache); in a controller that returns the View, but that开发者_StackOverflow does not w

I want to disable Browser Caching in a specific View.

I tried Response.Cache.SetCacheability(HttpCacheability.NoCache); in a controller that returns the View, but that开发者_StackOverflow does not work.

Any suggestions are greatly appreciated.

Thank you.


Try using the meta tag directly

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

put that at the top of your header. although the Response.Cache call is supposed to just put that in for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消