且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何配置ASP.NET MVC路由隐藏在&QUOT控制器名称;家"页?

更新时间:2023-02-17 08:58:49

试试这个:

   private void RegisterRoutes(RouteCollection routes) {

      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

      routes.MapRoute("default", "{controller}/{action}/{id}",
         new { action = "index", id = "" },
         // Register below the name of all the other controllers
         new { controller = @"^(account|support)$" });

      routes.MapRoute("home", "{action}",
         new { controller = "device", action = "index" });
   }

例如。 /富

如果是不是一个控制器,那么它当作的行动装置控制器。

If foo is not a controller then it's treated as an action of the device controller.