Santhos Santhos - 3 months ago 20
ASP.NET (C#) Question

Css bundling with dot in virtual path

Kendo configurator installed its css content into "~/Content/kendo/2016.1.226" folder. I need to create the same virtual path in the mvc bundler in order to make it work (see http://www.telerik.com/forums/asp-mvc-css-minification-breaks-kendo-bootstrap).

However, when I create the bundle:

bundles.Add(new StyleBundle("~/Content/kendo/2016.1.226/kendo-css").Include(
"~/Content/kendo/2016.1.226/kendo.common.min.css",
"~/Content/kendo/2016.1.226/kendo.default.min.css"));


I get 403 Forbidden response. Is there a way to make a virtual path containing dot work?

We use .net 4.6.1 and asp mvc 5.




Obviously, the fallback is to rename the folder and all the paths, but I am asking if there is another way.

Answer

This is because the name of your bundle (~/Content/kendo/2016.1.226/kendo-css) contains the same path as a physical path.

I would recommend changing your bundle name to something like ~/css/kendo or the like.

You should also use the rewriting then to fix the URLs, for example:

.Include("~/content/css/menusprites.css", new CssRewriteUrlTransform())

More can be found in this Telerik forum post: http://www.telerik.com/forums/asp-mvc-css-minification-breaks-kendo-bootstrap#KBg1hY3Z1EqbutQZxshjow