I am using YSlow to grade the performance of my application and I got an D grade for the Add Expires Header aspect.
I am using IIS express, so I found this code online and added it into the web.config file but it doesnt work; the grade is still D.
I did it in the web.config file. Any idea how to improve the grade of "Add Expires Header" ?
<system.webServer>
<staticContent>
<clientCache cacheControlMaxAge="30.00:00:00" cacheControlMode="UseMaxAge"/>
</staticContent>
Please try the below:
IIS -> Expand Sites -> Select your site -> Click 'HTTP Response Headers' -> Under 'Actions' on the right hand side, Click 'Set Common Headers' -> Tick 'Expire Web Content checkbox' -> Select 'After' radio button and then set the Days value to 7.
https://technet.microsoft.com/en-us/library/cc770661(v=ws.10).aspx
IIS -> Expand Sites -> Select your site -> Click 'Compression' -> Tick 'Enable dynamic content compression' and 'Enable static content compression'.
https://www.iis.net/configreference/system.webserver/httpcompression