当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.MapSubdomainRoute方法代码示例

本文整理汇总了C#中RouteCollection.MapSubdomainRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapSubdomainRoute方法的具体用法?C# RouteCollection.MapSubdomainRoute怎么用?C# RouteCollection.MapSubdomainRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.MapSubdomainRoute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapSubdomainRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
开发者ID:mppa-git,项目名称:aspnet4-multitenant-framework,代码行数:10,代码来源:RouteConfig.cs

示例2: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapSubdomainRoute(
                name: "Default",
                url: "",
                defaults: new { controller = "Static", action = "Index" }
            );

            routes.MapSubdomainRoute(
                name: "DownloadExtension",
                url: "extension/download",
                defaults: new { controller = "Static", action = "DownloadExtension" }
            );

            routes.MapSubdomainRoute(
                name: "Share",
                url: "share",
                defaults: new { controller = "Static", action = "Share" }
            );

            routes.MapSubdomainRoute(
                name: "ShareExtension",
                url: "extension/share",
                defaults: new { controller = "Static", action = "ShareExtension" }
            );

            routes.MapSubdomainRoute(
                name: "Error",
                url: "error",
                defaults: new { controller = "Static", action = "Error" }
            );

            routes.MapSubdomainRoute(
                name: "Redirect",
                url: "{id}",
                defaults: new { controller = "Redirect", action = "Redirect" }
            );
        }
开发者ID:hendrikmaarand,项目名称:vso.io,代码行数:40,代码来源:RouteConfig.cs

示例3: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            if (Properties.Settings.Default.DisplayMode == "Event")
            {
                routes.MapSubdomainRoute("Home",
                    "",
                    new { controller = "Event", action = "Index" },
                    new[] { "Portal.Controllers" });

                routes.MapSubdomainRoute("Program",
                    "program/{slug}",
                    new { controller = "Event", action = "Program", slug="" },
                    new[] { "Portal.Controllers" });

                routes.MapSubdomainRoute("Register",
                    "register",
                    new { controller = "Event", action = "Register" },
                    new[] { "Portal.Controllers" });
            }
            else
            {
                routes.MapSubdomainRoute("Home",
                    "",
                    new { controller = "Dashboard", action = "Public" },
                    new[] { "Portal.Controllers" });

                routes.MapSubdomainRoute("FeaturedMenu",
                    "child/Featured/{isMenu}",
                    new { controller = "Dashboard", action = "Featured" },
                    new[] { "Portal.Controllers" });

                routes.MapRoute("Logo",
                    "child/Logo",
                    new { controller = "Dashboard", action = "Logo" },
                    new[] { "Portal.Controllers" });

                routes.MapSubdomainRoute("HomeTitle",
                    "child/HomeTitle",
                    new { controller = "Dashboard", action = "HomeTitle" },
                    new[] { "Portal.Controllers" });

                #region Timeline
                routes.MapRoute("Legacy Details Url",
                        "timeline/details/{slug}",
                        new { controller = "Timeline", action = "Details" },
                        new string[] { "Portal.Controllers" });

                routes.MapRoute("Legacy Partner Url",
                    "timeline/partner/{slug}",
                    new { controller = "Timeline", action = "Partner" },
                    new string[] { "Portal.Controllers" });

                routes.MapSubdomainRoute("Timeline",
                        "timeline/{season}",
                        new { controller = "Timeline", action = "Index", season = 2014 },
                        new { season = @"\d+" },
                        new[] { "Portal.Controllers" });

                routes.MapRoute("OfficialEvent",
                        "timeline/{slug}/{action}/{series}/{id}",
                        new { controller = "Timeline", action = "Get", id = UrlParameter.Optional, series = UrlParameter.Optional },
                        new string[] { "Portal.Controllers" });

                #endregion
            }

             routes.MapSubdomainRoute("Search",
                            "search/{action}",
                            new { controller = "Search" },
                            new string[] { "Portal.Controllers" });

            routes.MapSubdomainRoute("Partners",
                    "partners",
                    new { controller = "Partners", action = "Public" },
                    new[] { "Portal.Controllers" });

            #region Thumbnails
            routes.MapSubdomainRoute("ThumbnailIndex",
                "thumbnail/{width}/{height}/{name}",
                new { controller = "Thumbnails", action = "Generate" },
                new[] { "Portal.Controllers" });
            #endregion

            #region News
            //routes.Add("Subdomain filter", new SubdomainRoute(
            //    "{domain}." + Properties.Settings.Default.BaseDomain,
            //    "news/{year}",
            //    new { controller = "News", action = "Index", year = 2014 },
            //    new { year = @"\d+" },
            //    new[] { "Portal.Controllers" })
            //);

            routes.MapSubdomainRoute("NewsIndex",
                "news/{year}",
                new { controller = "News", action = "Index", year = 2014 },
                new { year = @"\d+" },
                new[] { "Portal.Controllers" });

//.........这里部分代码省略.........
开发者ID:rallysportphoto,项目名称:Portal,代码行数:101,代码来源:RouteConfig.cs


注:本文中的RouteCollection.MapSubdomainRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。