我在ASP.NET CORE MVC 2.0项目中使用默认路由:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
我有一个超链接如下:
<a asp-controller="Services" asp-action="Information" asp-route-id="Gardens" class="btn btn-lg btn-outline-primary">Find out more</a>
它在运行时生成以下路径:
services/information?id=Gardens
但我想:
services/information/gardens