本文整理汇总了C#中System.Web.Mvc.UrlHelper.AbsoluteRouteUrl方法的典型用法代码示例。如果您正苦于以下问题:C# UrlHelper.AbsoluteRouteUrl方法的具体用法?C# UrlHelper.AbsoluteRouteUrl怎么用?C# UrlHelper.AbsoluteRouteUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.UrlHelper
的用法示例。
在下文中一共展示了UrlHelper.AbsoluteRouteUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSitemapNodes
public IReadOnlyCollection<SitemapNode> GetSitemapNodes(UrlHelper urlHelper)
{
List<SitemapNode> nodes = new List<SitemapNode>();
nodes.Add(
new SitemapNode()
{
Url = new System.UriBuilder(Request.Url.AbsoluteUri)
{
Path = Url.Content("~/"),
Query = null,
}.ToString(),
Priority = 1
});
nodes.Add(
new SitemapNode()
{
Url = new System.UriBuilder(Request.Url.AbsoluteUri)
{
Path = Url.Content("~/Constructor"),
Query = null,
}.ToString(),
Priority = 0.9
});
foreach (dynamic project in getPublicPolls())
{
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteRouteUrl("getPoll", new { poll = project.UrlCode }),
Frequency = SitemapFrequency.Weekly,
Priority = 0.8
});
}
return nodes;
}
示例2: GetSitemapNodes
public static IReadOnlyCollection<SitemapNode> GetSitemapNodes(UrlHelper urlHelper)
{
List<SitemapNode> nodes = new List<SitemapNode>();
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteContent("/Home"),
Priority = 1
});
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteContent("/Home/About"),
Priority = 0.9
});
HahaVilleContext db = new HahaVilleContext();
var listOfGategories = (from c in db.Category
select c.Name.Replace(" ", "-"));
foreach (var cat in listOfGategories)
{
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteRouteUrl("Category", new { action = "Category", name = cat }),
Frequency = SitemapFrequency.Monthly,
Priority = 0.9
});
}
var objTargetGame = (from g in db.Games
select
g.Name.Replace(" ", "-")
);
foreach (var game in objTargetGame)
{
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteRouteUrl("Game", new { action = "Details", name = game }),
Frequency = SitemapFrequency.Weekly,
Priority = 0.8
});
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteRouteUrl("Play", new { action = "Play", name = game }),
Frequency = SitemapFrequency.Weekly,
Priority = 0.8
});
}
nodes.Add(
new SitemapNode()
{
Url = urlHelper.AbsoluteContent("/Home/Contact"),
Priority = 0.7
});
return nodes;
}