Mark S.
6/7/2006 5:25:00 AM
On a static page I have:
<script type="text/javascript"
src="http://myServer/default.aspx?siteID=1"></script>
The aspx page (c# dotnet 2.0) builds a custom javascript file and returns it
to the browser. default.aspx only needs to be built once, per query string,
and then I would like the browser to Cache it (I'd take a 302, but would
prefer a full cache).
default.aspx code includes:
<%@ OutputCache Duration="604800" Location="Client" VaryByParam="None" %>
Response.ContentType = "application/x-javascript";
And IIS 6 (Windows 2003 Server) sets the expire time to two weeks in
advance.
Here are the returned headers:
(Response Status) HTTP/1.1 200 OK
Cache-Control private, max-age=604800
Content-Encoding gzip
Content-Type application/x-javascript; charset=utf-8
Date Wed, 07 Jun 2006 05:17:16 GMT
Expires Wed, 14 Jun 2006 05:17:16 GMT
Last-Modified Wed, 07 Jun 2006 05:17:16 GMT
Server Microsoft-IIS/6.0
Transfer-Encoding chunked
Vary Accept-Encoding
X-AspNet-Version 2.0.50727
The strange thing is if I visit the page, close the browser and then return
to the site default.aspx is cached by IE. However, if I hit reload, the page
auto refreshes or I click on a link and return with the back button, then IE
goes and gets a new copy of default.aspx.
How can I get default.aspx to be cached by IE until the expiration date?
TIA,
M