开发者

cache problem in asp.net

I'm seeing an issue of some static pages that are using the browser cache, which is not desired. To prevent caching, I'm setting

<clientCache cacheControlMode="DisableCache" />

in the relevant <location> tag in web.config

If I open the page in Firebug (in the Net tab), I see that th开发者_如何学JAVAe Response headers have Cache-Control: no-cache which is correct, but the status of the Response is 304 Not Modified! Isn't that a contradiction? How can I get it to stop caching (i.e. always send a 200 with content)?


According to the RFC (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1, section 14.9.1) Cache-control: no-cache tells the browser to not use the cached contents without first revalidating with the server. That's why you're seeing the 304's. I think you're looking for Cache-Control: no-store.

I'm not sure if you can send no-store via a configuration file. You can, however, set the header explicitly in the response:

Response.Cache.SetNoStore();

EDIT: (by OP)

What I was looking for was:

<clientCache cacheControlCustom="no-store" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜