How to set IIS caching using ASP.NET hosting

Most of the best ASP.NET hosting providers do not allow you to use IIS caching with their shared hosting plans due to limiting resources. So, if you would like to use caching then you should get VPS or Dedicated Windows hosting solution.

You could enable IIS caching in IIS using the element. In this way you could increase the web site performance. Page output caching stores a response of a dynamic page, such as an ASP.NET page, in memory after a browser requests it. Page output caching reduces server load and response time.

To configure the page caching in IIS you should follow the next steps:

1. Start Internet Information Services (IIS) Manager.

2. In the Connections pane, go to the connection, site, application, or directory for which you want to configure page output caching.

3. In the Home pane, scroll to Output Caching, and then double-click Output Caching.

4. In the Actions pane, click Add.

5. In the Add Cache Rule dialog box, type the file name extension you want to cache in the File name extension box, and then select the User-mode caching option, the Kernel-mode caching option, or both.

6. Select the options that you want to use for caching, and then click OK.

Configure the IIS caching via web.config:

<caching enabled=”true” enableKernelCache=”true”>
<add extension=”.aspx” policy=”CacheUntilChange” kernelCachePolicy=”CacheUntilChange” />