This project is read-only.

Cannot Get Route working in admin area?

Topics: Customizing Orchard, Writing modules
Aug 14, 2012 at 6:46 AM

Hi Guys,

I have a class Routes which implements IRouteProvider like so:


namespace Test.Auctions{ public class Routes : IRouteProvider


using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Envoy.Auctions.Routing;
using Orchard.Mvc.Routes;

namespace Test.Auctions
	public class Routes : IRouteProvider
		public void GetRoutes(ICollection<RouteDescriptor> routes)
			foreach (var routeDescriptor in GetRoutes())

		public IEnumerable<RouteDescriptor> GetRoutes()
			return new[] {
                             new RouteDescriptor {
                                                     Route = new Route(
                                                         new RouteValueDictionary {
                                                                                      {"area", "Test.Auctions"},
                                                                                      {"controller", "AuctionAdmin"},
                                                                                      {"action", "Create"}


Try as I might I cannot get this route to work if i try and go to /admin/Auctions/Create im getting:

"The controller for path '/OrchardLocal/Admin/Auctions/Create' was not found or does not implement IController."

my controller class looks like so:

namespace Test.Auctions.Controllers {
    [ValidateInput(false), Admin]    public class AuctionAdminController : Controller, IUpdateModel {


and the create like so:

 public ActionResult Create() {            if (!Services.Authorizer.Authorize(Permissions.ManageAuctions, T("Not allowed to create auctions")))                return new HttpUnauthorizedResult();
            var auction = Services.ContentManager.New<AuctionPart>("Auction");            if (auction == null)                return HttpNotFound();
            dynamic model = Services.ContentManager.BuildEditor(auction);            // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.            return View((object)model);        }


as you can see.. basically just like the blog code..


I'm just wondering what im doing wrong?



Aug 25, 2012 at 1:11 AM

Did you enable your module?

Sep 13, 2012 at 5:21 PM

Also, if the module doesn't compile or there is an error loading it, none of the routes will work.

You can use the BDN Route Debug module (available in the Orchard Gallery) to see what routes are active.

Also, check the logs for any errors. It's in the App_Data\Logs directory.