Hi guys
I'm using asp.net MVC with output caching (the OutputCache attribute) on some of my controller methods and am getting some really weird results in the HTTP headers.
When I add the attribute to the controller action that handles the main page view. the following header is produced:
Date Thu, 16 Jul 2009 23:04:58 GMT
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
X-AspNetMvc-Version 1.0
Content-Encoding gzip
Cache-Control public, max-age=300
Expires Thu, 16 Jul 2009 23:04:59 GMT <<<<<<<<< This is wrong
Last-Modified Thu, 16 Jul 2009 23:04:55 GMT
Vary *
Content-Type text/html; charset=utf-8
Content-Length 575
But when I add it to the controller action that renders a FileStreamResult result that sends down an image for that page, I get the following
Connection close
Date Thu, 16 Jul 2009 23:04:59 GMT
Server Microsoft-IIS/6.0
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Cache-Control public, max-age=300
Expires Thu, 16 Jul 2009 23:09:58 GMT <<<<<<<<< This is right
Last-Modified Thu, 16 Jul 2009 23:04:58 GMT
Vary *
You will note that there is a difference in the way that the Expires & Last-Modified is treated between the main page request and the image request.
To my minds eye the image one is correct because the Expires header is Last-Modified + max-age, but in the main page request, the Expires header is the same as the Last-Modified. I need both to be Last-Modified + max-age...
Whats gone wrong here, is it a bug somewhere??
Cheers Anthony