For developers: Retrieve page URL
You can programmatically retrieve the URL of a specific page using a number of methods.
You can get the URL of a page by calling the GetUrl method of the page node. To do so, perform the following:
- Get an instance of the page manager class.
- Find the page node using the page node ID.
- Call the GetUrlmethod of the page node.
When calling the GetUrl method, you specify the culture. - The absolute URL is resolved by calling the ResolveUrl method of the UrlPath class.
Alternatively, you can get the URL of a page by its ID using the sitemap node. To do so, perform the following:
- Get an instance of the current sitemap provider.
- Find the sitemap node using the page node ID.
- Cast the sitemap node to the PageSiteNode class.
- Call the GetUrl method of the PageSiteNode class.
When calling the GetUrl method, you specify the culture and set the fallback behavior. - The absolute URL is resolved by calling the ResolveUrl method of the UrlPath class.