本文整理汇总了C#中RouteCollection.MapUmbracoRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapUmbracoRoute方法的具体用法?C# RouteCollection.MapUmbracoRoute怎么用?C# RouteCollection.MapUmbracoRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapUmbracoRoute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapMemberRoute
/// <summary>
/// Create the member profile route - It's a fake page
/// </summary>
/// <param name="routes"></param>
/// <param name="nodeRoutePath"></param>
/// <param name="nodesWithPath"></param>
private static void MapMemberRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
{
foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>(AppConstants.PropMemberUrlName)))
{
if (string.IsNullOrWhiteSpace(nodeSearch.Key))
continue;
var routeHash = nodeSearch.Key.GetHashCode();
//Create the route for the /search/{term} results
routes.MapUmbracoRoute(
string.Format(MemberRouteName, routeHash),
(nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{membername}").TrimStart('/'),
new
{
controller = "DialogueMember",
action = "Show",
topicname = UrlParameter.Optional
},
new DialogueMemberRouteHandler(nodesWithPath));
}
}
示例2: MapMarkdownEditorRoute
private static void MapMarkdownEditorRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
{
//var routePath = (nodeRoutePath.EnsureEndsWith('/') + "a-new/" + node.Id).TrimStart('/');
var routeHash = nodeRoutePath.GetHashCode();
//var name = "articulate_markdown_new" + node.Id;
routes.MapUmbracoRoute(
"articulate_markdown_new" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + "a-new").TrimStart('/'),
new
{
controller = "MarkdownEditor",
action = "NewPost"
},
new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));
}
示例3: MapTagsAndCategoriesRoute
private static void MapTagsAndCategoriesRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
{
var routeHash = nodeRoutePath.GetHashCode();
//Create the routes for /tags/{tag} and /categories/{category}
routes.MapUmbracoRoute(
"articulate_tags_" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}").TrimStart('/'),
new
{
controller = "ArticulateTags",
tag = UrlParameter.Optional
},
new ArticulateTagsRouteHandler(nodesWithPath),
//Constraints: only match either the tags or categories url names
new { action = new TagsOrCategoryPathRouteConstraint(nodesWithPath) });
//Create the routes for the RSS specific feeds
routes.MapUmbracoRoute(
"articulate_tags_rss_" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + "{action}/{tag}/rss").TrimStart('/'),
new
{
controller = "ArticulateRss"
},
new ArticulateTagsRouteHandler(nodesWithPath),
//Constraints: only match either the tags or categories url names
new { action = new TagsOrCategoryPathRouteConstraint(nodesWithPath) });
}
示例4: MapSearchRoute
private static void MapSearchRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
{
//we need to group by the search url name and make unique routes amongst those,
// alternatively we could create route constraints like we do for the tags/categories routes
foreach (var nodeSearch in nodesWithPath.GroupBy(x => x.GetPropertyValue<string>("searchUrlName")))
{
//the hash needs to be the combination of the nodeRoutePath and the searchUrl group
var routeHash = (nodeRoutePath + nodeSearch.Key).GetHashCode();
//Create the route for the /search/{term} results
routes.MapUmbracoRoute(
"articulate_search_" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + nodeSearch.Key + "/{term}").TrimStart('/'),
new
{
controller = "ArticulateSearch",
action = "Search",
term = UrlParameter.Optional
},
new ArticulateSearchRouteHandler(nodesWithPath));
}
}
示例5: MapRssRoute
private static void MapRssRoute(RouteCollection routes, string nodeRoutePath, IPublishedContent[] nodesWithPath)
{
var routeHash = nodeRoutePath.GetHashCode();
//Create the route for the /rss results
routes.MapUmbracoRoute(
"articulate_rss_" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + "rss").TrimStart('/'),
new
{
controller = "ArticulateRss",
action = "Index"
},
new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));
routes.MapUmbracoRoute(
"articulate_rss_xslt_" + routeHash,
(nodeRoutePath.EnsureEndsWith('/') + "rss/xslt").TrimStart('/'),
new
{
controller = "ArticulateRss",
action = "FeedXslt"
},
new UmbracoVirtualNodeByIdRouteHandler(nodesWithPath));
}