My MVC5 website has a designated area called Freemium where I am encountering an issue with loading jquery and css files. While the bundles collection works smoothly for the rest of my website, it fails to load these essential files in the freemium area. After investigating the problem, I discovered that copying all the css and jquery files into the area folder solves the issue temporarily. However, I am reluctant to continue this manual process as it involves repetitive copy & paste actions.
When attempting to render the css and js using
@Styles.Render("~/Freemium/Content/metro-ui/css")
I encounter the following 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 are the bundle configurations that need to be functioning properly 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;
}