ASPNetFAQ.com: What is ASP.NET?

Technology posts on ASP.NET, IIS, Windows (+ a little Linux), Cloud Servers, Hosting, and more!
  • Blog Home
Search the site...

How to set content expiration for your IIS7 site

Tweet
Share
0 Shares

Do you want to assure that client browsers will always download the latest copy of your page(s) rather than potentially pulling an outdated page from their local cache? You can enable and manage content expiration in IIS7 to control this at the server-side. Below is a walk-through of enabling this using the IIS7 Remote Management Services.

You access the setting from the IIS management console: Select the HTTP Response Headers module:

Then on the right-hand side of the console click the Add Common Headers link:

The dialog box that shows next has an Expire Web Content checkbox:

From there you can select to have the content expire immediately if you don’t want the browser to cache anything at all; or to expire after a certain period of time (certain number of minutes, hours, days, etc.); or set it to expire on a certain specific date:

OrcsWeb’s managed hosting plans and Cytanium’s discount shared hosting plans all support IIS7 Remote Management Services. If you aren’t sure if your host supports this, just ask them. If they don’t you can still manage these settings through the web.config file.

Here’s a quick sample for turning off client caching for your .Net site:

<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode=”DisableCache” />
</staticContent>
</system.webServer>
</configuration>

Note that some hosts may have this feature locked down. If you encounter any issues just touch base with the host to confirm they support this.

Happy hosting!

More from my site

  • Basic IIS Performance StatisticsBasic IIS Performance Statistics
  • Setting up SSL in IIS7Setting up SSL in IIS7
  • Implementing Application Initialization on IIS 7.5Implementing Application Initialization on IIS 7.5
  • Magically Sync Machine Key for All Nodes in a Web FarmMagically Sync Machine Key for All Nodes in a Web Farm
  • Enable Caching in IIS to Speed PerformanceEnable Caching in IIS to Speed Performance
Tweet
Share
0 Shares
Hosting, IIS, Learning, Windows

3 comments on “How to set content expiration for your IIS7 site”

  1. Brian says:
    September 13, 2011 at 1:10 pm

    Great article! I was wondering how to do this recently.
    Thanks.

  2. NotApplicable says:
    February 22, 2013 at 1:28 pm

    Since you are familiar with IIS7 Web Site administration, I was wondering if you could help me out.

    Our Team is building a C# project with a Silverlight module. We deploy to a Windows 2008 with IIS 7. I’m trying to Programmatically Expire the HTTP Response Headers Associated with a Folder called ClientBin immediately. I know how to do it manually through IIS Manager. ( Basically, I go to the HTTP Response Headers Section of the folder or file that is of interest, and then I use “Set Common Headers….” to expire immediately.) However, we will be Redeploying to IIS a number of times, and I want to ensure that it is programmatically done because it’s a headache to keep Reconfiguring all the time.

    Should I do it from the C# code of my project or is it better practice to do it using WMI scripting and/or PowerShell?

    Could someone please assist?
    Thanks,

    Web Developer

    • Brad Kingsley says:
      February 23, 2013 at 11:02 am

      Sorry, but I’m not sure. Perhaps a site visitor will know and comment.

Proverbs 19:20

"Get all the advice and instruction you can, so you will be wise the rest of your life."

A Note On WordPress Hosting

Our main focus is of course .NET, but with a mix of Linux, virtualization, and other technologies. But if you're really looking for the best WordPress hosting specifically, read my WordPress host review to save yourself hassle AND money!




Recent Posts

  • What makes good web hosting?
  • jQuery Mobile C# ASP.NET and N5 Networks Software Repository
  • Open Source Bug Tracking Software and the Orchard Project
  • ASP.NET Development with Dreamweaver MX: Visual QuickPro Guide
  • Kendo UI Sample, ASP.NET Ajax Tutorial & More

Tags

ASP.NET Automation centos CMS css cytanium Development/Coding Email gmail Hosting htaccess http https IIS javascript Learning Linux logparser MySQL nginx openssl OrcsWeb performance PowerShell redirect RHEL security server SherWeb smtp SQL/Databases ssl System Administration telnet terminal tip Troubleshooting Ubuntu virtualization Visual Studio web farm web hosting Windows windows server Wordpress

Categories

  • ASP.net development
  • Development/Coding
  • Hosting
  • IIS (Internet Information Services)
  • SQL/Databases
  • System Administration
  • Virtualization
(c) ASPNETFAQ.com