16

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

This is my MVC BundleConfig.cs

        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js"));

        bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

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

        // The Kendo JavaScript bundle// or kendo.all.min.js if you want to use Kendo UI Web and Kendo UI DataViz
        bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
                                    "~/Scripts/kendo/kendo.web.min.js",
                                    "~/Scripts/kendo/kendo.aspnetmvc.min.js"));

Also you should know that i am running these 2 lines at the end of BundleConfig.cs

        bundles.IgnoreList.Clear();
        bundles.DirectoryFilter.Clear();

I have been getting 403 Access Denied , File Forbidden Errors when I try to host the project.

I have tried to use This Awesome Post as a reference, where I did change some things, but errors are still occuring.

I would like to think its because of the .min files KendoUI came with, but i can't be certain.

For your reference this is my _Layout.cshtml, and how i call the scripts.

    @Scripts.Render("~/bundles/jquery")
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/kendo")
    @Scripts.Render("~/bundles/kendo")
Don Thomas Boyle
  • 3,055
  • 3
  • 32
  • 54

2 Answers2

36

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")
Matt Millican
  • 4,044
  • 4
  • 38
  • 55
  • Freaking awesome, them both being in /Content was causing issues i guess?? - thanks for your quick reply also! – Don Thomas Boyle Aug 27 '13 at 21:00
  • 6
    For those interested: using `~/Content` for the `StyleBundle` doesn't work, because it's already an existing folder. – Rudey May 09 '14 at 09:29
4

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!

gicalle
  • 426
  • 4
  • 7