Razor Pages .NET Core 2.1 Child Routes

Refresh

5 days ago

Views

15 time

1

I'm working on a .NET Core 2.1 Razor Pages application, and can't figure out why the router isn't matching my expectations. In my application an Orchestration object has a collection of Rules objects. An Orchestration is defined queried at the DB with a Guid.

My Index.cshtml in the Orchestration folder looks like

@page "{id:guid}"
@model Website.Pages.Orchestration.OrchestrationModel

and predictably localhost/Orchestration/{guid} routes to the correct page.

My goal is localhost/Orchestration/{guid}/rule/{ruleId}/edit to hit the Edit.cshtml in the Rule folder. My attempts are close, but .NET is matching Orchestration/rule instead of Orchestration/{guid}/rule. I've tried several incantations trying to add {orchestrationid}/{id} to my Edit.cshtml in the Rule directory, but it's not working. This seems possible, I appreciate any help on what I'm missing.

note rule/Index.cshtml has been renamed to Edit

The Edit.cshtml file looks like

@page "{id}"
@model Website.Pages.Orchestration.Rule.RuleModel

The part that doesn't working is trying to access the child routes

enter image description here

0 answers