views:

418

answers:

2

My website is hosted on Windows server 2003, IIS 6.0. The website is developed on ASP.net, with Microsoft Framework 3.5

I have set the content expiry to 12 hours for the complete site using the following settings :

IIS Manager->Site->Properties->HTTP Headers->Enable Content Expiration->Expire After->12 Hours(s)

The Problem is that when i load the site, Expiry header is not being sent with the site. can any one please help me with this.

A: 

IIS 6 will only add this header to static content, e.g. anything not mapped to the asp.net handler (css, js, images, etc). Are you not seeing the header at all, or just not seeing it on your asp.net dynamic content/pages?

Nick Craver
Hey Nick thanks, i checked it out. Yslow shows that I have expires header with every request besides the js files that are fetched from google and addthis.but when i use wfetch, it shows no expires header
Umair
@Umair - If you can, use firebug when possible, then you can see the actual list of headers for each request very easily with the net panel. It's free and invaluable :) http://getfirebug.com/
Nick Craver
@Nick - firebug also doesnt show any expires header with any of my stuff
Umair
+1  A: 

When using "Expire After" option in IIS 6.0; IIS 6.0 doesn't send the "Expires" header, it instead sends the "Cache-Control" header to mark cache duration of static content on the client side.

If content should expire after 12 hours(12 hours * 3600 seconds = 43200 seconds), the following response header will be sent back.

HTTP/1.1 200 OK
...
Cache-Control: max-age=43200
...

IIS 6.0 will use the "Expires" Header if you set the exact date on which contents should expire.

Leyu
where shall I use these lines? as there is .htaccess for asp.net applications
Umair
@Umair the fragment above is HTTP response which the web server sends for a request.
Leyu
well with PHP I can add a cache control header within the .htaccess file, I want to know how to do this with ASP.net + IIS 6.0.
Umair
@Umair for static resources you can use the IIS 6.0 ContentExpiration settings to enable caching.For full control over caching use ASP.NET Caching Features; using HttpResponse.Cache property the HttpCachePolicy class can be manipulated to add caching features. See http://msdn.microsoft.com/en-us/library/xsbfdd8c%28VS.71%29.aspx for details.
Leyu