UrlBuilder url = new UrlBuilder(EPiServer.Configuration.Settings.Instance.SiteUrl + linkUrl); EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, page.PageLink, UTF8Encoding.UTF8);
Will give the right url, but you need to provide the SiteUrl
Good idea, although it still includes the language URL prefix.
I ended up writing my own utility method for building the corresponding URL.
I have a problem getting the language specific URLs for pages in EPiServer.
The background: I have developed a site with several enabled languages. EPiServerFramework.config is set up so that www.[client].se maps to the Swedish versions of the pages, www.[client].com to English, www.[client].es to Spanish, etc.
This works very well, and the pages doesn't have the /language/ URL prefix.
On the pages there is a possibility to click on links on the page to change to other language versions of the page (generated server-side).
My problem is - is there an easy way to generate these links, and automatically get them to point to the corrent domain name?
Right now I'm building the links with UriSupport.AddLanguageSelection(...), but that results in links such as /sv/blabla/ and /en/yadayada/, i.e. not including the domain, and each URL is prefixed with the language code.
While I realize it's easy to loop through EPiServerFrameworkSection.Instance.SiteHostMapping and do everything manually, I'd really like a more elegant (and automated) solution to this.
Does anyone have any experience of doing this?