我想像Bellow一样做路线配置,
http://domain.com/AboutMe然后它将进入Home Controller - AboutMe Action http://domain.com/ContactMe然后它将进入Home Controller - ContactMe Action
它适用于以下路由配置,
routes.MapRoute(
name: "Custom",
url: "{action}",
defaults: new { controller = "Home" }
);
但是以下链接不起作用,
http://domain.com/Login然后它将进入登录控制器 - 登录操作 http://domain.com/RegisterMe然后它将进入登录控制器 - RegisterMe Action
所以这是我的疑惑,
我可以在路由配置时传递多个控制器名称,因此它将在Home&amp ;;中搜索我的操作。帐户两个控制器,
即。像,
routes.MapRoute(
name: "Custom",
url: "{action}",
defaults: new { controller = "Home,Account" }
);
或
routes.MapRoute(
name: "Custom",
url: "{action}",
defaults: new { controller = new string[] { "Home", "Account" }
);