November Happy Hour will be moved to Thursday December 5th.

Get pageReference from external URL

Vote:
 

Hi

I have some links that I need to resolve to pageReferences, the PermanentLinkUtility.GetContentReference seems like the ideal solution but does not work.

The way I've implemented it is as follows

var site = "http://site.com/url/subpage";
var url = new UrlBuilder(site);
var a = PermanentLinkUtility.GetContentReference(url);

This doesn't work at all in an EPi 7 MVC site.

Any advice where to start?

#78972
Dec 05, 2013 17:46
Vote:
 

In EPiServer 7.5 you can use:

string url = "http://site.com/subpage";

var contentReference = UrlResolver.Current.Route(new UrlBuilder(url));

#78983
Dec 06, 2013 8:25
Vote:
 

That should basically apply to CMS 7 as well, but then there is no static Current property on UrlResolver, instead you should get the instance from IOC/ServiceLocator.Currrent

#78986
Dec 06, 2013 9:10
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.