0
votes

I have a MVC5 website with one area called Freemium. I used bundles collection for my entire website and everything works really well except when I open the freemium area. All of my jquery and css files are not load! I try to figure out the problem and the only solution I found is to copy all the css and jquery files into the area folder but I don't want to do that because that will always be the same files copy & paste.

So when I render the css and js with

@Styles.Render("~/Freemium/Content/metro-ui/css") 

I get the error:

The controller for path '/Freemium/Content/metro-ui/css' was not found or does not implement IController. Stack trace: at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)**

Here it's the bundles I need to make working in the freemium area.

private static BundleCollection SetMetroUIFreemiumBundles(BundleCollection bundles)
    {
        // CSS
        bundles.Add(new StyleBundle("~/Freemium/Content/metro-ui/css/metrocss")
            .Include("~/Content/metro-ui/css/metro-bootstrap.css"
            , "~/Content/metro-ui/css/metro-bootstrap-responsive.css"
            , "~/Content/metro-ui/css/iconFont.min.css"));

        // Scripts
        bundles.Add(new ScriptBundle("~/Freemium/Scripts/metro-ui/metrojs")
            .Include("~/Scripts/metro-ui/jquery.ui.widget.js"
            , "~/Scripts/metro-ui/metro.min.js"));

        return bundles;
    }
1
It's been a while since I created an MVC site, but shouldn't it be @Styles.Render("~/Freemium/Content/metro-ui/css/metrocss")?jwatts1980
OMG, I work for too long I have not seen my path error. Thank you very much!! I'll take a break!!Karine
I added this comment as the answer. Happy coding!jwatts1980

1 Answers

2
votes

It's been a while since I created an MVC site, but shouldn't it be

@Styles.Render("~/Freemium/Content/metro-ui/css/metrocss")

The Render("path") path should match the new StyleBundle("path").