Exemplo n.º 1
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            MobilGameTask mobilGameTask = new MobilGameTask();

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            foreach (var item in mobilGameTask.GetAll(null, ""))
            {
                routes.Add("DomainRouteName" + item.Domain.ToLower(),
                           new DomainRoute(string.Format("{0}.w3wgame.com", item.Domain.ToLower()),
                                           "{action}/{id}", new { Controller = "games", action = "index", id = "" }
                                           ));
            }

            routes.MapRoute(
                "Default",                    // 路由名称
                "{controller}/{action}/{id}", // 带有参数的 URL
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // 参数默认值
                );
        }