I took a two months long hiatus from writing to transition into my new role at work. It’s all good now and I am back with an overdue post about Sitecore 8.1
Sitecore 8.1 has finally added native support for MVC areas. If you’ve used areas before (using this option, for example) you probably were calling
<initialize> and registering your routes in
You can now take your own area registration out. Or can you? Here’s how Sitecore changed the
protected virtual void RegisterRoutes(RouteCollection routes, PipelineArgs args)
The problem is - area registration is called after route handlers have been set. I briefly mentioned the custom route handlers in my older blog post about Sitecore MVC routing mechanisms. This is what makes otherwise regular MVC routes Sitecore aware. No custom handlers on your routes means no
mvc.* pipelines, no
PageContext, no analytics.
All the routes that you were registering in
RegisterArea()are now not part of the Sitecore MVC ceremonies. They are late to the party.