0
votes

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.

1
Possible duplicate of this - stackoverflow.com/questions/9775063/… - sh1rts
Not sure it is a duplicate of that. Code was working as expected under IIS6 and now functions differently under IIS7. The other post refers to a scenario where the code never worked as the user wanted. - user3348622

1 Answers

0
votes

I used the URL Rewrite module to change the cache settings as no other method (declarative, programmatic, web.config, HTTPModule) etc seems to be able to change the cache response header.