MVC 路由设置伪静态

 public static void RegisterRoutes(RouteCollection routes)
        {
           routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
           routes.MapRoute("Defaults", "{controller}/{id}.html",
           new { controller = "Home", action = "Info", id = UrlParameter.Optional },
           new { controller = @"News|Solutions" },
           new[] { "Web.UI" });
         
          
            routes.MapRoute(
               name: "Default",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
               namespaces: new string[1] { "Web.UI" }
           );
        }

  然后在Web.config 的<system.webServer>节点下添加<modules runAllManagedModulesForAllRequests="true" />

  iis中应用池模式改为集成模式,并在处理程序中添加通配符

posted on 2016-05-18 16:45  落叶子  阅读(677)  评论(0编辑  收藏  举报

导航