利用.net中的web.config使用浏览器缓存? [英] Leverage browser caching with web.config in .net?
问题描述
有些站点位于共享主机(Windows 2003 Server)上,所以我无法访问服务器配置。
Some of sites are on shared hosting (Windows 2003 Server), so I have no way to access server configuration.
我到处都读到有关利用浏览器缓存的信息,特别是对于静态文件(jpg,css,js等),但是...在我的情况下该怎么做?
I read everywhere about leverage browser caching, expecially for static files (jpg, css, js, etc.) but... how to do this in my case?
主机已安装.NET,可以通过网络.config文件以某种方式提供帮助?如果是,怎么办?
The hosting has .NET installed, could a web.config file help in some way? If yes, how?
推荐答案
这是我在共享主机上的网站上所做的事情。我相信cacheControlMaxAge的天数为:hours:minutes:seconds,但不要引用我。
Here is how I did on my site that is on a shared host. I believe the cacheControlMaxAge is as follows days:hours:minutes:seconds but dont quote me.
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="3.00:00:00" />
</staticContent>
</system.webServer>
这篇关于利用.net中的web.config使用浏览器缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!