Created
July 28, 2020 15:51
SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://www.progress.com/documentation/sitefinity-cms/for-developers-retrieve-page-url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Telerik.Sitefinity.Services; | |
using Telerik.Sitefinity.Web; | |
namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Pages | |
{ | |
public partial class PagesSnippets | |
{ | |
private string GetUrlByPageNodeIdAlternative(Guid pageNodeId, string targetCulture, bool resolveAsAbsolutUrl) | |
{ | |
var siteMap = SiteMapBase.GetCurrentProvider(); | |
// Get the siteMapNode | |
var siteMapNode = siteMap.FindSiteMapNodeFromKey(pageNodeId.ToString()) as PageSiteNode; | |
var culture = SystemManager.CurrentContext.AppSettings.GetCultureByName(targetCulture); | |
var url = String.Empty; | |
if (siteMapNode != null) | |
{ | |
// Get the URL of the siteMapNode | |
url = siteMapNode.GetUrl(culture, false); | |
if (resolveAsAbsolutUrl) | |
{ | |
// Get the absolute URL of the pageNode | |
url = UrlPath.ResolveUrl(url, true, true); | |
} | |
} | |
return url; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment