S
S
strify_252016-08-08 13:19:51
ASP.NET
strify_25, 2016-08-08 13:19:51

How to set up caching of static files in asp.net?

Good afternoon! Previously, I did not work with asp, the task arose to configure caching of css files. I found this instruction:
metanit.com/sharp/mvc5/20.5.php
I do as it says, I inserted it into web.config

<system.webServer>
      <staticContent>
        <clientCache cacheControlCustom="public;max-age" cacheControlMaxAge="10.00:00:00" cacheControlMode="UseMaxAge" />
      </staticContent>
    </system.webServer>

As a result, an error 500 is issued. Tell me, how to properly configure the cache?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kovalsky, 2016-08-08
@dmitryKovalskiy

I'm sorry, but why do you need to manually cache css? Do you update it every 5 minutes? And after updating the application, hang a sticker - "do not forget to reset the cache." Asp.net has a StyleBundle mechanism that will glue your css for you and will control versioning - when it changes, it will update the hash and the client will pick up new styles using the new link received.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question