简体   繁体   中英

.net app caching issue after migrating from IIS6 to IIS7

We recently migrated from a Windows 2003 web server running IIS6 to a Windows 2008 web server running IIS7. The application in question is an ASP.NET web site running under .net4 on both the old and new. None of the code has changed.

However, I have noticed that .aspx web pages expire now when the user uses the back button. On the old web server users could use the back button to go and see the results on a previous page (knowing the data may not be the most up to date possible) and now on the new web server they get a "page expired" message.

I had a look at a web page's headers with Fiddler. On IIS6 the caching column in Fiddler is reporting "private" and on IIS7 it is "no-cache, no-store; Expires: -1". It's this difference, I'm assuming, that is causing the pages to expire where they did not before.

How can I set the caching/expiry behaviour of IIS7 to match the behaviour users are used to from running under IIS6? I've been trying to use "HTTP Response Headers" in the IIS7 gui as well as modifying the static content in the web.config:

<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseExpires" httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" />
</staticContent>
</system.webServer>

but nothing I've tried so far has let me change these expiry options.

我使用URL Rewrite模块来更改缓存设置,因为似乎没有其他方法(声明性,编程式,web.config,HTTPModule)等能够更改缓存响应标头。

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