When I used the kendo ui, I found the weird behavior: the site works perfect on development environment (debug mode), but the styles and image references to kendo ui are missing in production environment (release mode).
After a lot of research, I found out this article and it explained every well:
StyleBundle 403 Error - Solved!
Basically, when you create StyleBundle, the virtual path matters. It has to match up to the last slash before the style sheet. The last part of the virtual path is essentially a throw away name.
For example:
I put the kendo css files in /Content/kendo folder. I have to create my StyleBundle for kendo style like:
bundles.Add(new StyleBundle("~/Content/kendo/css").Include("~/Content/kendo/kendo.common.css", "~/Content/kendo/kendo.default.css"));
In view, I render the style bundle like: @Styles.Render("~/Content/kendo/css")
You can also define the bundle like this:
bundles.Add(new StyleBundle("~/Content/kendo/style").Include("~/Content/kendo/kendo.common.css", "~/Content/kendo/kendo.default.css"));
And render the style bundle like: @Styles.Render("~/Content/kendo/style")
The last part of the virtual paths in my two examples (css and style) are just a throw away name, but the path before them must match the path in the Include method.
After a lot of research, I found out this article and it explained every well:
StyleBundle 403 Error - Solved!
Basically, when you create StyleBundle, the virtual path matters. It has to match up to the last slash before the style sheet. The last part of the virtual path is essentially a throw away name.
For example:
I put the kendo css files in /Content/kendo folder. I have to create my StyleBundle for kendo style like:
bundles.Add(new StyleBundle("~/Content/kendo/css").Include("~/Content/kendo/kendo.common.css", "~/Content/kendo/kendo.default.css"));
In view, I render the style bundle like: @Styles.Render("~/Content/kendo/css")
You can also define the bundle like this:
bundles.Add(new StyleBundle("~/Content/kendo/style").Include("~/Content/kendo/kendo.common.css", "~/Content/kendo/kendo.default.css"));
And render the style bundle like: @Styles.Render("~/Content/kendo/style")
The last part of the virtual paths in my two examples (css and style) are just a throw away name, but the path before them must match the path in the Include method.
Comments