Xperience 13 Content tree-based routing with MVC Areas

Mike Young asked on June 1, 2021 22:46

We upgraded our MVC full framework site to xperience 13. The site uses MVC areas and I am wondering if that may be why the content tree-based routing is not behaving as expected? I have set up Xperience 13 as a new site and had no problem with the content tree-based routing then, it's only on this upgraded MVC site with areas that I am hitting problems.

In the MVC site I have this route defined in RoutingAssemblyInfo.cs:

[assembly: RegisterPageRoute(TestPageType.CLASS_NAME, typeof(TestPageController), ActionName = "Index")]

The above references all resolve fine according to Visual Studio. The Kentico generated classes and the controller all look good.

In Global.asax I am enabling the feature:

    protected void Application_Start()
    // Gets the ApplicationBuilder instance
    // Allows you to enable and configure selected Xperience MVC integration features
    ApplicationBuilder builder = ApplicationBuilder.Current;

    // Enables content tree-based routing




The TestPageController never gets hit when I enter the URL that is defined in the Page URL field in the CMS. The MVC site serves up a not found page.

If anyone has any ideas they would be much appreciated, thanks!

Correct Answer

Sean Wright answered on July 6, 2021 23:39

Areas were never supported or recommended in Kentico 12 / Kentico Xperience with the Page Builder.

I'm guessing they don't work with the Content Tree Routing either.

Areas are typically used by non-Kentico MVC projects to handle routing, but with Content Tree routing being handled by Kentico Xperience, I don't think using Areas brings the same benefits.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Mike Young answered on July 7, 2021 00:18

Cool thanks for the knowledge!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.