Set image expiration date in asp.net

Using asp.net in visual studios and IIS7 when I get a host.

I have a folder with icons that rarely change and are used on every page. Is there a way that I can set a specific directory to expire something like once every 2 hours so that I can reduce the amount of incoming request to the server?

+3
source share
1 answer

You do this in IIS. If you are using IIS 7, you can add a header to your web.config. Its in the system.webServer section.

<staticContent>
    <clientCache httpExpires="Sun, 29 Mar 2020 00:00:00 GMT" cacheControlMode="UseExpires" />
</staticContent>

, HTTP-, 2020 . , ASP.NET, , script .

, :

<staticContent>
    <clientCache cacheControlMaxAge ="2.00:00:00" cacheControlMode="UseMaxAge" />
</staticContent>

, HTTP-, 2 .

+14

Source: https://habr.com/ru/post/1730692/


All Articles