When I added a new Area in my DXA application, Visual Studio scaffolded out a RegisterArea method in the AreaRegistration... which adds a route mapping for the area.

public override void RegisterArea(AreaRegistrationContext context) 
        new { action = "Index", id = UrlParameter.Optional }

I'm not sure how to deal with this. On the one hand, it's handier to have all the routing together in the global asax. On the other hand, I can see benefits in keeping area-specific code in the area.

I'm therefore leaning towards keeping it where it is, but first I'd like to be clear that there are no good reasons not to. Would I need to modify this code in order to have it work well with DXA?

Edit: My class inherits from BaseAreaRegistration, as indicated by the documentation. Unfortunately, the documentation doesn't really cover this issue. Presumably, even if VS hadn't scaffolded the routing, I'd still need to consider whether I need custom routing for my area, and if so where best to put it.

If you examine the route mappings in the Global.asax, they all reference the Core area specifically, like this:


It's not clear to me what this does, or whether it's relevant.

I suppose the point is that the DXA page controller takes over complete responsibility for the whole URL, rather than having the route parse out controller/action/id by default. The route is still called "Core_Page": is it reasonable to assume that the name doesn't have any functional effect?

2 Answers 2


The DXA Framework provides base class BaseAreaRegistration which is a subclass of ASP.NET MVC's AreaRegistration. It's best to let your AreaRegistration inherit from DXA's BaseAreaRegistration. See http://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v5/GUID-01A0F1FA-C15E-4549-A2A8-50DD8FA42F80

  • Thanks Rick. I've updated the question to make it more specific about the source of my doubts. Commented Aug 8, 2016 at 15:52
  • If your custom Area only contains custom Views and/or Entity Controllers, you don't need more than what's in the DXA docs; the BaseAreaRegistration base class takes care of the (virtual) routes to your custom Entity Controllers (if any). If your area contains "real" controllers (i.e. one that respond to incoming HTTP request), you can indeed add routes in the RegisterArea override(don't forget to also call base.RegisterArea in that case!) Commented Aug 8, 2016 at 15:59

You firstly need to register your area as mentioned in the above document. But caveat is every page request goes from page-controller. so your custom route is treated as page and DXA try to find it as page.

so to execute your custom controller action from area you can try either of following steps.

  1. One way to add your route on top in the list in Global.asax.
  2. Another way without updating global.asax, specify your controller and action in the component template metadata and add with a component on the page. it will execute your action and display the view. I have done this via creating a module in the DXA CM and that modules maps to counter-part area in DXA CD.
  • 2
    The DXA Page Controller is indeed quite "eager". That is: by default it is configured to handle all URLs (except specific routes defined earlier in Global.asax.cs). If your area contains a "real" Controller (i.e. one that has to handle complete HTTP request rather than being invoked by a Page/Region Controller), it should be possible to define a route in the area registration. You may have to swap the calls to RegisterRoutes and RegisterAllAreas in Global.asax.cs. Commented Aug 8, 2016 at 20:39
  • actually i was talking in context of Custom plugin module, how can i make my custom module route to be handled by controller from same module/area. as i can not get swapping in this scenario.
    – Raj Kumar
    Commented Aug 14, 2016 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.