This project is read-only.

Routes not finding controller

Topics: Writing modules
Dec 16, 2011 at 12:31 PM

Hello, I'm trying to emulate the FeaturedItemSlider in inserting a menu item on the admin screen that is used to manage content items. When I go to the route address (or click on the menu item pointing to it) an exception is thrown that it can't find the controller type.


namespace weVi.EmbeddedContent
    public class Routes : IRouteProvider
        public IEnumerable<RouteDescriptor> GetRoutes()
            const string areaName = "EmbeddedContent";
            var emptyConstraints = new RouteValueDictionary();
            var sliderRouteValueDictionary = new RouteValueDictionary { { "area", areaName } };
            var mvcRouteHandler = new MvcRouteHandler();

            return new[] {
                new RouteDescriptor {
                    Route = new Route(
                        new RouteValueDictionary {
                            {"area", areaName},
                            {"controller", "Admin"},
                            {"action", "NewCreate"}
                        emptyConstraints, sliderRouteValueDictionary, mvcRouteHandler)

        public void GetRoutes(ICollection<RouteDescriptor> routes)
            foreach (var routeDescriptor in GetRoutes())


namespace weVi.EmbeddedContent.Controllers
     [ValidateInput(false), Admin]
    public class AdminController : Controller

        private readonly IContentManager _contentManager;

        public AdminController(IContentManager contentManager, IShapeFactory shapeFactory)
            _contentManager = contentManager;
            Shape = shapeFactory;

        dynamic Shape { get; set; }

        public ActionResult NewCreate()


The exception is: The controller for path '/Admin/EmbeddedContent/Sources' was not found or does not implement IController.


Does anyone have any ideas? Thanks.

Dec 16, 2011 at 7:28 PM

Might be the area name.

Dec 16, 2011 at 9:05 PM

Thanks, there were two issues. The area name needs the full scoping of the namespace "weVi.EmbeddedContent" and also the namespace must match the assembly name. I had changed the namespace and not encountered any issues until now, but there you go.