Get LinkURL in page´s language and not current

March 21, 2011 EPiServer Troubleshooting Snippet
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: