【发布时间】:2018-11-21 12:04:15
【问题描述】:
我正在玩asp.net razor pages。
我创建了默认的 asp.net core 2.1 应用程序,然后添加了 3 个页面:
default convention 页面将在路径中可用:
Page1 -> http://localhost/Page1
Page2 -> http://localhost/Folder/Page2
Page3 -> http://localhost/Page3
现在我想为 page2 添加一个别名,例如像这样:
Page1 -> http://localhost/Page1
Page2 -> http://localhost/Page2
Page2 -> http://localhost/Folder/Page2
Page3 -> http://localhost/Page3
如果没有adding-file-as-link,是否可以为此页面创建额外的路由/别名?
在@page 中指定页面路由
@page "/Page2"
@{
ViewData["Title"] = "Page2";
}
<h2>Page2</h2>
将 page2 设为 http://localhost/Page2,但不设为 http://localhost/Folder/Page2 :(
【问题讨论】:
标签: c# asp.net-core asp.net-core-mvc razor-pages