【发布时间】:2019-11-19 03:05:35
【问题描述】:
当我在我的程序中使用 *catchall 时,我的路由不正确。
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
app.UseMvc(routes =>
{
routes.MapRoute(
name: "AdminArea",
template: "{area:exists}/{controller=home}/{action=index}/{id?}");
routes.MapRoute(
name: "SimplifyAsdreaAdmin",
template: "{controller=home}/{action=index}/{id:int?}/*Catchall");
});
}
当我在第二条路由中删除 *catchall 时,路由它运行正常。但是当我需要去区域时放 *catchall (例如:管理员) 给我这个网址:https://localhost:44339/home/temping?area=Admin
有人知道为什么会这样吗?
【问题讨论】:
标签: c# asp.net-mvc asp.net-core