Merhaba arkadaşlar google page speed üzerinde sitemizi testlere tabi tuttuğumuzda bizden tarayıcı önbellekleme özelliğini aktif etmemizi istemektedir, bunun için aşağıdaki kod satırını web.config e eklemeniz yeterlidir.
1 2 3 4 5 |
<httpProtocol allowKeepAlive="true"> <customHeaders> <add name="Cache-Control" value="public, max-age=998200" /> </customHeaders> </httpProtocol> |
Veya alternatif olarak aşağıdaki koduda kullanabilirsiniz.Bu kodun farkı hangi nesneleri önbellekmesini seçme şansımızın olmasıdır
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<caching> <profiles> <add extension=".png" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> <add extension=".gif" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> <add extension=".jpg" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> <add extension=".js" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> <add extension=".css" policy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> <add extension=".axd" kernelCachePolicy="CacheUntilChange" varyByHeaders="User-Agent" location="Client"></add> </profiles> </caching> <httpProtocol allowKeepAlive="true"> <customHeaders> <add name="Cache-Control" value="public, max-age=691200"></add> </customHeaders> </httpProtocol> |