【发布时间】:2019-07-05 13:26:52
【问题描述】:
我正在开发一个 .NET Core 2.1 Razor Pages 应用程序,但无法弄清楚为什么路由器不符合我的期望。在我的应用程序中,Orchestration 对象具有一组 Rules 对象。编排定义在数据库中使用 Guid 进行查询。
Orchestration 文件夹中的我的 Index.cshtml 看起来像
@page "{id:guid}"
@model Website.Pages.Orchestration.OrchestrationModel
并且可以预见localhost/Orchestration/{guid} 路由到正确的页面。
我的目标是localhost/Orchestration/{guid}/rule/{ruleId}/edit 在 Rule 文件夹中点击 Edit.cshtml。我的尝试很接近,但 .NET 匹配的是 Orchestration/rule 而不是 Orchestration/{guid}/rule。我尝试了几种咒语,试图将{orchestrationid}/{id} 添加到我的规则目录中的 Edit.cshtml,但它不起作用。这似乎是可能的,我很感激任何我所缺少的帮助。
note rule/Index.cshtml 已重命名为 Edit
Edit.cshtml 文件看起来像
@page "{id}"
@model Website.Pages.Orchestration.Rule.RuleModel
不起作用的部分是尝试访问子路由
【问题讨论】:
标签: c# razor razor-pages