在 asp.net 核心 2 - 如何导航到绝对根页面
In asp.net core 2 - How to navigate to absolute root page
我无法从区域中的页面找到根索引页面的路径。
这应该是一个简单的问题,但我在网上找不到解决方案。
所有这些方法return到当前Area
的根。
<form asp-page="@Url.Content("~/Index")" method="post></form>
<form asp-page="/Index" method="post></form>
使用asp-page
时,当前区域假设。 docs 略微谈到了这一点:
When the area is not specified, routing depends on the ambient values. The current route values of the current request are considered ambient values for link generation.
为了彻底清除该区域,请使用以下方法:
<form asp-area="" asp-page="/Index" method="post></form>
我无法从区域中的页面找到根索引页面的路径。
这应该是一个简单的问题,但我在网上找不到解决方案。
所有这些方法return到当前Area
的根。
<form asp-page="@Url.Content("~/Index")" method="post></form>
<form asp-page="/Index" method="post></form>
使用asp-page
时,当前区域假设。 docs 略微谈到了这一点:
When the area is not specified, routing depends on the ambient values. The current route values of the current request are considered ambient values for link generation.
为了彻底清除该区域,请使用以下方法:
<form asp-area="" asp-page="/Index" method="post></form>