IIS Caching of .NET components

  • Thread starter Thread starter Tim Smith
  • Start date Start date
T

Tim Smith

Our ASP.NET application, using the .NET 1.0 framework servers up .aspx
pages to the browser. Each GET and POST request should never be
cached - and never is.

However there is a number of javascript, cascading styles sheet and
image files that are being sent to the browser with every page request
(if I examine the HTTP flow).

How can I prevent these files from being sent each time if they are
not modified - is this a .NET Framework issue or an IIS issue?
 
If the files are being served by IIS (and they would be, by default) it's an
IIS configuration issue. Use the IIS Manager to set HTTP Expiration times
for the directories containing static content files. (Right click my
computer. Choose manage. Choose services | IIS. Expand the folder tree.
Right-click the folder, choose properties. Click the HTTP Headers tab.
Place a checkmark in the "Enable Content Expiration" box. Expire content a
set interval of time later".

Please note that due to the way HTTP works, the client won't even request a
cached file-- so either keep a reasonably short expiration time (Office
Online uses 1 day) or change the filenames every time you make a change.
See the book "HTTP: The Definitive Reference" for more details.

(See http://www.fiddlertool.com for a free tool which can help analyze
problems like this. In the "Expires" column, you'll see responses which
contain no CACHE-CONTROL: max-age or EXPIRES: headers. These responses will
not be cached by the browser.)

Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top