MVC bundeling : Err 403

前端 未结 2 619
傲寒
傲寒 2021-01-07 22:07

Using VS\'12, Asp.net - C# - InternetApplication Template, KendoUI, EF Code First

This is my MVC BundleConfig.cs



        
相关标签:
2条回答
  • 2021-01-07 23:11

    Try changing

    bundles.Add(new StyleBundle("~/Content/kendo").Include(
                "~/Content/kendo/kendo.common.*",
                "~/Content/kendo/kendo.default.*"));
    

    to

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

    and then

    @Styles.Render("~/Content/kendo")
    

    to

    @Styles.Render("~/bundles/css/kendo")
    
    0 讨论(0)
  • 2021-01-07 23:12

    it's because you're using the same 'alias' (/Content/kendo) for the stylebundle as the already existing directory.

    once you use another alias (/Content/css/kendo/ or /Content/whatevernonexistingdir) your problem is solved.

    but be aware: the 'root' of the css is changed, so when using (background) images in your css which are pointing to subfolders, take this into account!

    0 讨论(0)
提交回复
热议问题