Try our conversational search powered by Generative AI!

Get content page from relative friendly url



How can I get a content page from it's friendly relative url. e.g. /folder-one/folder-two/page/


Oct 21, 2014 15:06
Oct 21, 2014 15:21

Unfortunately that does work for me :(

I have the following example code:

var resolver = ServiceLocator.Current.GetInstance<UrlResolver>();
var urlBuilder = new UrlBuilder("");
var contentReference = resolver.Route(urlBuilder);

The site has a page named "Page-One", but the contentRefefrence is always null.

Is this something to do with routing, the site was a CMS6R2 site which has been upgraded to 7.5 (still web forms)

Oct 21, 2014 16:34

After decompiling the UrlResolver I see my problem.

The code checks whether the host I am sending in is in the site definitions, if it isn't it returns null.

The Url I was browsing the site with was not in the site defintions hence the problem.

If I use the page path rather than the absoute url it works fine as it uses the default site defition.

Oct 22, 2014 9:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.