Link to an page in user control

Topics: General
Apr 21, 2011 at 5:39 PM

I have an user control, where I have selected the last 3 pages edited.

When I have the IPage object, how do I get the URL to this page, so I can link to it?

Coordinator
Apr 21, 2011 at 9:34 PM

there're 2 ways of getting the url:

1) With help of SitemapNavigator class - each page in Sitemap has a "URL" attribute 

2) By using Composite.Data.PageUrl class

 

using Composite.Data;


IPage page;

...

string url = new PageUrl(page.DataSourceId.PublicationScope, page.DataSourceId.LocaleScope, page.Id).Build(PageUrlType.Public).ToString();

 

P.S. We're preparing a new api for working with urls in C1, so it will require much less code to get page's urls :)