在App_Theme文件夹CSS获取浏览器的缓存 [英] CSS in App_Theme folder gets Cached in Browser

查看:204
本文介绍了在App_Theme文件夹CSS获取浏览器的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App_Theme文件夹的样式表在浏览器中被缓存。应该用什么方法呢?这样,每当有新的部署中的浏览器应该采取的最新样式,而不是一个在浏览器高速缓存。

这是发生其他的CSS(这是不是在主题文件夹)也一样,在链接中提到这样用自定义的控制

<一个href=\"http://blog.sallarp.com/asp-net-automatic-css-javascript-versioning/\">http://blog.sallarp.com/asp-net-automatic-css-javascript-versioning/

这怎么会在主题文件夹中的CSS做?

编辑:的主题名称在web.config如下所述提及。因此它不只是HTML链接,我曾通过在链路中提到的方法解决了标签

 &LT;页=样式表里默认&GT;
      &LT;控制与GT;      &LT; /控制&GT;
    &LT; /页&GT;


解决方案

我也有碰到过这一点,我想出了一个解决方案是一个版本添加到你的CSS文件名,而不是pretty但没有上禁用缓存IIS我能想到的没有其他办法。


  

重命名CSS文件说
  mycss-V1.0.css,这将迫使你
  用户的Web浏览器重新加载CSS


The Stylesheet in the App_Theme folder gets cached in the browser. What should be the approach? so that whenever there is a new deployment the browser should take the latest stylesheets and not the one cached in the browser.

This was happening for other css(which are not in theme folder) too, so used custom control as mentioned in the link

http://blog.sallarp.com/asp-net-automatic-css-javascript-versioning/

How this could be done for the CSS in the Theme folder?

Edit: The theme name is mentioned in the web.config as mentioned below. so its not just the html link tag which I had solved by using the method mentioned in the link.

 <pages styleSheetTheme="Default">
      <controls>

      </controls>
    </pages>

解决方案

I too have come across this and the solution I came up with is to add a version to your CSS filename, not pretty but without disabling cache on IIS I could think of no other way.

Rename the CSS file to say mycss-V1.0.css, which will force your user's web browsers to reload the CSS

这篇关于在App_Theme文件夹CSS获取浏览器的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆