【发布时间】:2018-04-25 10:16:18
【问题描述】:
如何使用 core 2 在 mvc 中创建用户路由?早期,我只在 ASP.NET 中使用过:
context.MapRoute(
"index",
"index",
defaults: new
{
area = "AnoterArea",
controller = "Base",
action = "Index"
});
但是现在我该怎么办? 我正在尝试做类似的事情..
app.UseMvc(routes =>
{
routes.MapAreaRoute(
"index",
"Index",
"{controller}/{action}/{id?}",
new
{
controller ="Base",
action = "Index"
});
});
你说什么?
【问题讨论】:
-
您应该正确地格式化您的代码,以便他人阅读。
-
@Heri 你能说更多吗?
标签: c# asp.net-core-mvc asp.net-core-2.0