Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tomasz 22 posts 95 karma points
    Jun 05, 2017 @ 23:23
    Tomasz
    0

    Handling of unset culture / hostname setting

    Hi, I am trying to figure out best way to handle cultures / hostnames I do not have configured in the BackEnd.

    I have a single root node that is configured with 3 cultures (en, nz, au). When I try browsing the site for lets say /de that I do not have setup in the CMS, I'd like to direct users to a "default" /en site, rather than a 404 that I currently get.

    Also, I am struggling a bit with is trying to test this accordingly. My locality is NZ, when I call .GetCulture() on a page, I get NZ, no matter if I am on / or /en or /nz or /au site (which does make sense).

    By default, when I type in my dev URL, I get to / homepage, with website navigation (and links in general) pointing to /nz/... and culture debug message on page saying en-NZ. When I manually go to /au links are updated (culture doesn't change).

    Any ideas how best to handle cultures I don't "expect" to provide content for?

  • Tomasz 22 posts 95 karma points
    Jun 07, 2017 @ 06:03
    Tomasz
    0

    I employ Geo coding across the site and decided to use the combination of the GEO vs my "allowed" cultures with preferred location detection. I use an override for OnApplicationStarting setting a custom RenderMvcController

    DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(LanguageRedirectRenderMvcController));

    Side note: be aware that Model.Content.GetCulture() will give you different result to Model.CurrentCulture

Please Sign in or register to post replies

Write your reply to:

Draft