E
E
Extramezz2016-11-20 13:12:48
IIS
Extramezz, 2016-11-20 13:12:48

Caching on IIS server (ASP.NET)?

I have the most common IIS server with ASP.NET.
Tell me, how can I enable sending caching http headers on it when requesting JS, CSS, etc. files?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Filandor, 2016-11-20
@Extramezz

In web config:

<system.webServer>

    
   <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00" />
    </staticContent>
    
   <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>
    
    <urlCompression doStaticCompression="true" doDynamicCompression="true" /> 
.................

but for different versions of IIS, there may be different sets of instructions .... + probably not all directives are allowed by the virtual host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question