0条评论
还没有人评论过~
endpoints.MapControllerRoute(
name: "blog-list",
pattern: "{controller}/{category?}",
defaults: new { Controller = "Blog", Action = "List" }
);
endpoints.MapControllerRoute(
name: "blog-info",
pattern: "{controller}/{action}/{id?}"
);
比如说我想配置 /blog/58.html
其中58是id
假如 Action 名称是 Info ,可以使用下面的路由配置
endpoints.MapControllerRoute(
name: "blog-info",
pattern: "{controller}/{id}.html",
defaults: new { Controller = "Blog", Action = "Info" }
);