Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Greg Fyans 140 posts 342 karma points
    Dec 07, 2020 @ 10:02
    Greg Fyans
    0

    Overriding surface controllers using the same name

    I have created a base-build Nuget package that includes all the doctypes, data types, templates, views, and controllers that I need to start building an Umbraco site.

    I have installed this into a clean solution and for this particular website, I want to override one of the controllers e.g. in my package I have:

    NavigationController : SurfaceController

    And I want to create a new NavigationController like this:

    NavigationController : BaseBuild.Controllers.NavigationController

    The reason I want it to be the same name is so that I don't have to update any of the views that uses existing Actions on the base build NavigationController.

    The problem is, when I boot Umbraco now I get the following error:

    A route named 'umbraco-surface-Navigation' is already in the route collection. Route names must be unique.

    So, is there a way I can completely override the base build NavigationController without changing the name, and without running into this error?

Please Sign in or register to post replies

Write your reply to:

Draft