asp.net-mvc - 在system.web.optimization中自定义缓存清除

标签 asp.net-mvc asp.net-optimization system.web.optimization

当启用优化时从捆绑中渲染样式时,您会得到以下信息:

<link href="/Content/themes/base/css?v=UM624qf1uFt8dYtiIV9PCmYhsyeewBIwY4Ob0i8OdW81" rel="stylesheet" type="text/css" />
不幸的是,Android浏览器似乎在它们上没有load urls with query strings。有什么方法可以在System.Web.Optimization中自定义此字符串?

编辑:

My question is answered and I tried to detect android on user agent string and replace with a querystring less link to the stylesheet. Apparently the problem I had wasn't because of the querystring, it was minified version of the webfont css that was causing it not to load the stylesheet completely in the Android stock browser.

Android stock browser fails to load css content string with escaped backslash which was a workaround for the ASP.NET minifier that erronously minifies the same css content string. I ended up putting the icon font css styles on it's own "minified by hand" stylesheet.

最佳答案

目前,我们不支持自定义版本字符串在url中的显示方式。

这是我们的Codeplex网站上的问题的链接:Url version issue

同时,如果您愿意每次更改包时都手动修改包路径,则可以避免使用帮助程序,而只需拥有指向您包的显式链接,即可在每次包更改时对其进行更新:

<link href="/Content/themes/base/css" rel="stylesheet">

或者您可以通过bundle.Cacheability = HttpCacheability.NoCache禁用客户端上的缓存

关于asp.net-mvc - 在system.web.optimization中自定义缓存清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15290488/

相关文章:

c# - 在不再存在的临时 asp.net 文件中生成的类型

c# - 只返回 View 的 Controller Action 是否有必要异步?

javascript - 通过单击动态插入的链接来调用函数

system.web.optimization - 调试时如何缓存单独渲染的文件?

asp.net-mvc - MOQ:不能将 Moq.Mock 转换为 VB.Net 中的接口(interface)

c# - Web.Optimizations - 有什么方法可以从 Style/Script Bundle 中获取所有内容?

visual-studio-2010 - BundleTable.Bundles.RegisterTemplateBundles

asp.net - 使用 'System.Web.Optimization' 压缩由 asp.net 捆绑创建的 bundle ?

css - 如何设置 System.Web.Optimization bundler 以正确转换 ISO unicode

javascript - 我应该捆绑哪些 js/css 文件?