Try our conversational search powered by Generative AI!

PageData.PageLink is not returning correct language version URL


I'm continuing my struggle with EPiServer multi language support starting form here:

Now I have a problem from getting correct page URL for a language version in a custom generic handler.

Lets say this is my Generic Handler Code:

public void ProcessRequest(HttpContext context)
    PageReference testRef = new PageReference(38); //Some page with both english and german versions
    LanguageSelector langSelectorTest = new LanguageSelector("de"); //We want german version
    PageData test = EPiServer.DataFactory.Instance.GetPage(testRef, langSelectorTest);
    //test.LanguageBranch - is de - correct!
    //test.LanguageID - is de - correct!
    //test.PageName - is german version - correct!
    //test.PageLink - is "/SomePath/SomeName.aspx?id=38&epslanguage=en" - Not correct

    //Let's try GetPageLanguage version
    PageData testAgain = test.GetPageLanguage(langSelectorTest.LanguageBranch);
    //testAgain.PageLink - is "/SomePath/SomeName.aspx?id=38&epslanguage=en" - Not correct

public bool IsReusable
        return false;

For some reason PageLink is returning URL for english version instead of german

Jun 09, 2011 11:24
Jun 09, 2011 13:15

Hi Anders,
it looks like the same problem. Meanwhile, a colleague of mine gave me this solution:

UrlBuilder url = new UrlBuilder(UriSupport.AddLanguageSelection(page.LinkURL, page.LanguageID));
return url.ToString();

Jun 09, 2011 14:36
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.