gpt4 book ai didi

razor - 在 .Net Core 中导航到另一个文件夹中的页面

转载 作者:行者123 更新时间:2023-12-02 03:36:15 26 4
gpt4 key购买 nike

我有一个使用 Razor Pages 的 .Net Core 应用程序。在 Pages 下,我有两个顶级文件夹 - Prescriptions 和 Admin。在 Prescriptions 文件夹下,我有一些搭建的 CRUD 页面——即创建、索引、编辑和删除。当我输入地址 https://localhost:44344/Prescriptions程序转到 Prescriptions 文件夹中的索引页面 - 工作正常。

在 Admin 文件夹下,我有一个名为 Client 的页面,它有一个 anchor 标记:

<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="/处方"。我错过了什么?

最佳答案

我刚刚尝试了您的部分,并让它与以下代码一起工作。

<a asp-page="../Prescription/Index">Prescription</a>

希望对您有所帮助!

关于razor - 在 .Net Core 中导航到另一个文件夹中的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50102406/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com