zl程序教程

您现在的位置是:首页 >  后端

当前栏目

asp.net mvc中配置路由默认值(Area中)

NetASP配置路由MVC 默认值 Area
2023-09-11 14:20:28 时间
  public class RouteConfig
    {
        private static string[] namespaces = new string[1] { "Best.Site.Areas.BestPalace" };
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.IgnoreRoute("ActiveReports.ReportService.asmx/{*pathInfo}");
            routes.IgnoreRoute("ActiveReportService.asmx/{*pathInfo}");
            routes.IgnoreRoute("{*allActiveReport}", new { allActiveReport = @".*\.ar10(/.*)?" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}"
                ,
                defaults: new { controller = "MenuAddress", action = "Index", id = UrlParameter.Optional },
                namespaces: namespaces
            ).DataTokens["area"] = "BestPalace";
        }
    }