开发者

Why is caching such an issue in .net 3.5?

Has anyone else having an issue with browser caching when using .net? I am using VS 2008 and IE8. And I include all the recommended code to ensure开发者_运维百科 that there is no caching, still 20% of the time, I get cached values. This was never an issue with classic asp. Any ideas?


If you want to insure you get fresh results, append a nonce to the query string, or, if there is no query string, introduce one, that contains a nonce.

Instead of requesting http://foo/bar.htm , request http://foo/bar.htm?_=4944994230.

This works with static content or dynamically-generated content. You can name the parameter anything. In this case I just used an underscore. Just be careful to not duplicate the name of a querystring param that is used by the actual application.

To make it transparent, you can do this in browser-script, in the click event of a button before submitting a form. This is how jQuery implements its "do not use cache" option for ajax requests.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜