将旧网站移植到 Core 3.0 并且在新的脚手架身份区域和指向该区域内页面的锚标记方面遇到了一些问题。
例如旧的 MVC 代码
<li>
<a tabindex="-1" asp-controller="Account" asp-action="Login">
<i class="si si-logout pull-right"></i>Login
</a>
</li>
<li>
<a tabindex="-1" asp-controller="Register" asp-action="Register">
<i class="si si-lock pull-right"></i>Register
</a>
</li>
现在变成什么了?我正在尝试在标签助手中使用 asp-area,但似乎无法正确获取操作或页面路径。
<li>
<a tabindex="-1" asp-area="Identity" asp-page="/Account/Login">
<i class="si si-logout pull-right"></i>Login
</a>
</li>
<li>
<a tabindex="-1" asp-area="Identity" asp-page="/Account/Register">
<i class="si si-lock pull-right"></i>Register
</a>
</li>
以及如何使用 asp-action 参数来获取后面 .cs 代码中的特定方法?
好吧,我创建了一个新的 Asp.Net Core 3.0 Web 应用程序,使用个人用户帐户,搭建了 Identity 并查看了 Login 部分,我上面的内容就是该模板中显示的内容。当我单击注册时,它只会路由到空白屏幕。使用这个网址
https://localhost:44367/?area=Identity&page=%2FAccount%2FRegister
现在该 url 看起来不正确,但该代码是它在模板中的样子。这是一个 MVC Web 应用程序,脚手架的 Identity 是 Razor。这是问题吗?我假设脚手架在解决方案中放置了渲染剃刀视图所需的任何库。
我怎样才能让它工作?