Developer forum

Forum » Development » Service to fetch FriendlyUrl

Service to fetch FriendlyUrl

Vincent Gercke
Reply

Hi,

Is there a service to fetch the value here based on the AreaID:

Dynamicweb.Content.Area has the property UrlName but not the friendly url. I also tried to use SearchEngineFriendlyURLs.GetFriendlyUrl with the area id (AreaId=Id), but it only seems to work with a page id as well.

BR Vincent


Replies

 
Nicolai Pedersen
Reply

Depending on your area settings, getting the first page of the area is an option and pass that to search friendly urls:

var firstPage = Services.Pages.GetFirstPageForArea(Area.ID);

Are you using the new UrlHandling or the older UrlProviders - you know? A lot of those APIs are not public I am affraid.

BR Nicolai

 
Vincent Gercke
Reply

Thanks! Yes, I also tried that but then I get /area/page and I just want /area/

It would be nice the the method SanitizeUrl was made public, then I could just use that on the UrlName :-)

 

You must be logged in to post in the forum