Adding expire headers for static content

Static content from a site can put unnecessary load when rendering content. Assets such as images, scripts and styles can be cached using an expire header to stop them from being requested on each HTTP request.

It would be wise to add a version number or date of the change to the end of each static item to allow the cache to be updated when new assets are added. For example

.png?v=1 or .css?v=01012017 .js?v=1

The cache can then be called either through setting a Common HTTP Response Headeror through code


or by add the following code to your web.config

 <clientCache cacheControlCustom="public" cacheControlMaxAge="12:00:00" cacheControlMode="UseMaxAge"/>

Hide your .net framework version

Keeping your framework version up to date is always preferable, but for those projects that can’t be upgraded to the new framework version, you can always hide it.

The version number of your framework will be shown in the header of a request. Add the following code in your web.config file to stop the version from being shown.

<httpRuntime enableVersionHeader=”false” />