【发布时间】:2018-12-26 13:24:26
【问题描述】:
无法让嵌套(子)区域与 Razor 页面一起使用。我想要一个类似的路由结构:
/Index
/Admin
/Admin/Orders
/Admin/Inventory
目前我的文件结构如下:
/Pages
/Index.cshtml
/Areas
/Admin
/Inventory
/Pages
/Index
/Models
/Orders
/Pages
/Index
/Models
/Product
/Models
/Pages
我的Admin.Index 页面如下所示:
@page
@model ECommerceWeb.Areas.Admin.Pages.AdminModel
@{
ViewData["Title"] = "Admin";
}
<h2>Admin</h2>
<ul>
<li><a asp-page="Index" asp-area="Inventory">Inventory</a></li>
<li><a asp-page="/Orders/Orders" asp-area="Admin">Orders</a></li>
</ul>
<form method="post">
<button type="submit" name="action" value="logoutButton">Logout</button>
</form>
从上面的两个<li>可以看出,我尝试了各种方法。
【问题讨论】:
标签: c# asp.net-core asp.net-webpages