I have a LandingPageResolver that inherits from HttpRequestProcessor. From here I am pulling the current request url from HttpContext. I'd like to get the full request url including language code. However HttpContext.Current.Request.Url doesn't return url with language code.

Ex: Request from browser: http://domain.com/nl HttpContext.Current.Request.Url : http://domain.com/

Thank you in advance.

2 Answers 2


This is because Sitecore strips it out of the URL once it identifies it as a valid language code. It happens here:

<processor type="Sitecore.Pipelines.PreprocessRequest.StripLanguage, Sitecore.Kernel" />

Which is a processor in the <preprocessRequest> pipeline, which runs before the <httpRequestBegin> pipeline that you have hooked in to.

The code in question looks like this:

  Language language = StripLanguage.ExtractLanguage(args.Context.Request);
  if (language == (Language) null)
  Context.Language = language;
  Context.Data.FilePathLanguage = language;
  StripLanguage.RewriteUrl(args.Context, language);

Depending on what you are trying to do; you should probably just check for the "base" url (without the language qualifier) and then in your Landing Page Resolver check the value of Context.Data.FilePathLanguage. If this returns non NULL you will know that a language code was part of the URL and has been removed by the StripLanguageProcessor.

  • Hi Mark, this is exactly what I'm looking for. Checking Context.Data.FilePathLanguage if returns Null solves my problem. Thanks for your help!
    – arseny
    Nov 14, 2016 at 3:34

The language is removed in the URL in the preprocessRequest pipeline and is controlled by the setting Languages.AlwaysStripLanguage.

        This setting specifies if the StripLanguage processor in the <preprocessRequest> pipeline will parse and remove languages from
        the URL, even when the languageEmbedding attribute of the linkProvider is set to "never". You should only change this setting 
        to "false" if the default behavior causes problems in your solution.
        Default value: true 

<setting name="Languages.AlwaysStripLanguage" value="true"/>

I believe you should be able to use HttpContext.Current.Request.RawUrl for the full URL including the language part. However, I do remember something about it not matching Request.Url completely - you might have to experiment a bit with this or turn off the setting mentioned above.

You can also check Sitecore.Context.Data.FilePathLanguage to get the language stripped from the URL if any.

  • 1
    Hi Soren, I tried experimenting on the config turning it off however it always gives me 404. Luckily I can use Sitecore.Context.data.FilePathLanguage which solves my probelm :) Thanks for your help!
    – arseny
    Nov 14, 2016 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.