Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的控制器是“/Home/Index”。我希望,当我输入 url 到“/Dashboard/Index”或“example.com/Dashboard”时,我的“/Home/Index 操作方法”会执行。你能给我起点吗?
只需将此路线添加到您的路线配置中。确保在默认路由之前添加它:
routes.MapRoute( name: "HomeRoute", url: "Dashboard/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );