How to register actual MVC arearegistration in Route.cs

Topics: General, Localization
Mar 12, 2014 at 8:15 PM
Hi,

I have requirement like, I have Area inside my Orchard Module which is MVC project. Please guide me that how to register AreaRegistrationContext in Route.CS.

from below code i am able to hit controller method but it's not able to find view from ~/Area/AreaName/View/ContollerNameFolder/view.chtml

Route.cs new RouteDescriptor {
                                                 Priority = 1,
                                                 Route = new Route(
                                                     "Test/{controller}/{action}",
                                                     new RouteValueDictionary {
                                                                                  {"area", "Test"},
                                                                                  {"controller", "Base"},
                                                                                  {"action", "Index"},
                                                                                  {"namespaces","Enterprise.Mvc.Areas.Test.Controllers"}
                                                                              },
                                                       new RouteValueDictionary (),
                                                     new RouteValueDictionary {
                                                                                  {"area", "Test"}
                                                                              },
                                                     new MvcRouteHandler())
                                             },
__
Actual MVC area registration :
__
using System.Web.Mvc;

namespace Enterprise.Mvc.Areas.test1
{
public class test1AreaRegistration : AreaRegistration
{
    public override string AreaName
    {
        get
        {
            return "test1";
        }
    }

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "test1_default",
            "test1/{controller}/{action}/{id}",
            new { action = "Index", id = UrlParameter.Optional }
        );
    }
}
}

How to register this kind of routes to Route.cs of Orchard?

Thanks in Advance!!