Configuring caching in system.web.optimization

When rendering styles from packages during optimization, it is included:

<link href="/Content/themes/base/css?v=UM624qf1uFt8dYtiIV9PCmYhsyeewBIwY4Ob0i8OdW81" rel="stylesheet" type="text/css" /> 

Unfortunately, the Android browser does not look like loading URLs with request chains . Is there a way that you can customize this line in System.Web.Optimization?


Edit:

My question was answered, and I tried to find the android in the line of the user agent and replace it with a link with a smaller line to the stylesheet. Apparently, the problem I had was not due to the request, it was a mini version of webfont css, which forced me not to load the stylesheet completely in the Android Android browser.

Android share browser does not load css content string with escaped backslash , which was a workaround for ASP.NET minifier, which excludes the same css content string . I ended up creating css font styles for the icons on his own minified by hand stylesheet.

+6
source share
2 answers

We currently do not support setting how the version string is displayed in the URL, unfortunately.

This is a link to a problem on our codeplex website: Url version issue

In the meantime, if you want to live with manually changing the package path every time you change the package, you can simply avoid using helpers and just have explicit links to your packages that you update every time your package changes:

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

Or you can disable client caching using bundle.Cacheability = HttpCacheability.NoCache

+4
source

You can disable caching with

 @{string path = BundleTable.Bundles.ResolveBundleUrl("~/bundle/cssCommon", false);} //may apply manual path transformation to remove ?v= anyway <link href=@path rel="stylesheet" type="text/css" /> 

or short form

 <link href="@BundleTable.Bundles.ResolveBundleUrl("~/bundle/cssCustom", false)" 

But you will have problems with caching, not problems with the Android web interface. Another possible approach is to use Microsoft Ajax Minifier

+9
source

All Articles