本文整理汇总了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 }
);
}
示例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" }
);
}
示例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" });
//.........这里部分代码省略.........