【发布时间】:2018-10-10 15:51:18
【问题描述】:
我有一个使用 Razor Pages 的 .Net Core 应用程序。在 Pages 下,我有两个顶级文件夹 - Prescriptions 和 Admin。在 Prescriptions 文件夹下,我有一些我搭建的 CRUD 页面——即创建、索引、编辑和删除。当我输入地址 https://localhost:44344/Prescriptions 时,程序会转到 Prescriptions 文件夹中的索引页面 - 工作正常。
在 Admin 文件夹下,我有一个名为 Client 的页面,它有一个锚标记:
<a asp-page="./Prescriptions/Index"Add Prescription</a>
我正在尝试导航到页面https://localhost:44344/Prescriptions。
我已经尝试了一百种不同版本的这个标签,包括:
<a asp-page="Prescriptions"Add Prescription</a>
<a asp-page="/Prescriptions"Add Prescription</a>
等等。但我无法让它工作。将 href 与相对路径一起使用效果不佳 - 例如href="/处方"。我错过了什么?
【问题讨论】:
标签: razor asp.net-core navigation razor-pages