Clear Client Browser Cache with IIS

So you’ve updated your site and now you realise that some clients can’t see the changes of images/css because they all retain the same names as the old version?

Well in IIS you can change the Content Expiry Header to force the client to get the latest versions of the files.

For IIS 7 follow the step from Microsoft.

  1. In Features View in IIS, double-click HTTP Response Headers.
  2. On the HTTP Response Headers page, in the Actions pane, click Set Common Headers.
  3. In the Set Common HTTP Response Headers dialog box, select the Expire Web content check box and select one of the following options:
    • Select Immediately if you want content to expire immediately after it is sent in a response.
    • Select After if you want the content to expire periodically. Then, in the corresponding boxes, type an integer and select a time interval at which content expires. For example, type 1 and select Days if you want the content to expire daily.
    • Select On (in Coordinated Universal Time (UTC)) if you want the content to expire on a specific day and at a specific time. Then, in the corresponding boxes, select a date and time at which the content expires.

For IIS 6:

  1.  In IIS Manager, double-click the local computer; right-click the Web Sites folder, an individual Web site folder, a virtual directory, or a file; and then click Properties.
  2. Click the HTTP Headers tab.
  3. Select the Enable content expiration check box.
  4. Click Expire immediately, Expire after, or Expire on, and type the appropriate expiration information in the corresponding boxes.

 

2 thoughts on “Clear Client Browser Cache with IIS

  1. You can also append a querystring, say…. site.css?v=129 if you don’t have access to IIS

    • Excellent point, I had to use my method when I didn’t know what was wrong with some closed source app running on an IIS server.

Leave a Reply