简体   繁体   中英

Caching in ASP.NET MVC

I have two pages in my web app showing similar data. The user switches back and forth between the two. 1 is a web form and the other MVC/razor. (i'm in the process of switching to MVC).

Both pages have:

<meta http-equiv="expires" content="Fri, 1 Jan 1990 00:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" value="no-cache, no store, must-revalidate" />

IE (8, 9) with cache settings to automatically always shows correct results in the webform but not in the MVC page. Chrome works perfectly with both pages.

How is this possible if both pages have the same meta tag values for caching?

Meta tags are not fully supported across all browsers. You should also include HTTP cache control headers to get more browsers in line.

I would like to stress, however, that the decision of whether or not to cache anything is browser-specific. The best you can do is ask the browser not to cache. There are other techniques you can use to trick a browser into not caching your data. Putting some random value on the end of a url that's ignored by the server is one such technique.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM