Multiple Endpoints Matched / Multiple Sites / Razor Class Libraries

2025/03/14 5:19 PM

I'm currently going down this path on a project, and I'm curious if anyone has insight on how to best tackle what I'm attempting to do.

For my initial round of trying to get something up and running, I have a HomeController in each of my two RCL projects (Group and Agency). They're both individually registered to use the same content type, but have different values being sent in for the WebsiteChannelNames array.

Group:
[assembly: RegisterWebPageRoute(HomePage.CONTENT_TYPE_NAME, typeof(HomeController), WebsiteChannelNames = [XperienceConstants.GroupWebsiteChannelName])]

Agency:

[assembly: RegisterWebPageRoute(HomePage.CONTENT_TYPE_NAME, typeof(HomeController), WebsiteChannelNames = [XperienceConstants.AgencyWebsiteChannelName])]

When I run my solution, hosting each channel at a separate localhost port, I get the following error message on both sites:

1.00

Based on the description of the WebsiteChannelNames field, I would assume that it should be differentiating between the two controllers, based on which channel the request is coming from.


Environment

  • Xperience by Kentico version: 30.2.2
  • .NET version: 8
  • Execution environment: localhost

Answers

2025/03/17 9:37 PM
Answer

After some help from Sean W., a solution has been found for this problem.

To get around this issue, you can rename your controllers to be unique between the projects, which allows the routing to work as expected. So in my case, updating mine to be GroupHomeController and AgencyHomeController, and updating the typeof parameter in each respective RegisterWebPageRoute to match, resolved this issue for me.

To answer this question, you have to login first.