In an ASP.NET site, I would like to add an "Expires" header to certain static files, so I added a clientCache
configuration like this for the folder where these file are:
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseExpires" httpExpires="Wed, 13 Feb 2013 08:00:00 GMT" />
</staticContent>
If possible, I would like to compute the value of httpExpires
programmatically, to set it for example to the time the file was last updated + 24 hours.
Is there a way to configure the cache control to get the value of httpExpires
by calling a method?
If not, what are the alternatives? I thought about writing a custom http handler, but maybe there is a simpler solution...
EDIT: please note that these are static files, so they are not served by the regular asp.net page handler.