Setting optimum http caching headers and server params in ASP.Net MVC and IIS 7.5

后端 未结 1 1246
我寻月下人不归
我寻月下人不归 2021-02-04 04:19

I have an ASP.Net site (happens to be MVC, but that\'s not relevant here) with a few pages I\'d like cached really well.

Specifically I\'d like to achieve:

相关标签:
1条回答
  • 2021-02-04 04:48

    I'm not sure if you've solved this problem yet (several months later...), but this should be possible.

    SetMaxAge should set the amount of "guarranteed" fresh time. If you additionally send an ETag, you'll have satisfied 3 & 4. Requirements 1 & 2 can be solved orthogonally with whatever server-side caching mechanism you use: I've never used ASP.NET server-side cache like this, but it's almost certainly possible.

    I'd remove extraneous headers from your responses such as SetRevalidation - why would this be necessary?

    0 讨论(0)
提交回复
热议问题