Try our conversational search powered by Generative AI!

Get URL of pages

Vote:
 

Hi,

through below code i m able to get all the pages which are located under the root page.

but i want to find the URL of all the pages.

i m not able to figure out how to get the URL.

could you please help me on this.

 PageDataCollection children = EPiServer.DataFactory.Instance.GetChildren(PageReference.RootPage);

#151665
Aug 03, 2016 11:04
Vote:
 

Something like this?

foreach (var child in children)
{
    var pageUrl = UrlResolver.Current.GetUrl(child);
}

If UrlResolver.Current is unavailable in EPiServer 7, then you could use something like this:

var pageUrl = ServiceLocator.Current.GetInstance<UrlResolver>().GetVirtualPath(pageLink);
#151669
Edited, Aug 03, 2016 12:41
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.