03 Dec Leverage Browser Caching for Windows Servers-IIS
You can leverage browser caching for Microsoft (Windows/ASP.NET) servers by either configuring it in the IIS Manager or adding a small snippet to the web.config file. Read more below:
Add a snippet to the web.config file (most commonly used option)
Add the below snippet to the web.config file. The web.config file should be placed in the document root of your website.
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
The above snippet will cache all the static resources that your web pages load. You can control the cache period via the cacheControlMaxAge setting. Right now the setting is set to 30 days.
Via the IIS Manager
Follow the below steps:
1. Navigate to Start menu >> Administrative Tools >> Internet Information Services (IIS) Manager.
2. Find your app in the list on the left side.
3. Right-click on the app and select Output Caching in the menu.
4. Now click on Add. You can now add caching rules for any web file type you wish.
You may want to know about Leverage Browser Caching Apache Linux: