锚标签助手

Anchor tag helper 用于生成 href 属性以链接到特定的控制器操作或 MVC 路由。基本的例子

<a asp-controller="Products" asp-action="Index">Login</a>

有时,我们需要为要绑定的控制器操作指定其他参数。我们可以通过使用 asp-route-prefix 添加属性来指定这些参数的值。

<a asp-controller="Products" asp-action="Details" asp-route-id="@Model.ProductId">
   View Details
</a>