Get LinkURL in page´s language and not current

This is a kind of weird thing about the LinkURL property of a PageData object in EPiServer. Even though the page in in a specific language, the LinkURL will ignore that and return a link to the current language version instead.

If you want the URL to be in the same language as the page is, instead of:
string url = page.LinkURL;
..start using AddLanguageSelection and pass the page´s language ID:
string url = EPiServer.UriSupport.AddLanguageSelection(page.LinkURL, page.LanguageID);

Related posts:


comments powered by Disqus