Try our conversational search powered by Generative AI!

SimpleAddress route sets ContentLanguage.PreferredCulture even if it didn't match a route

Vote:
 

Hi,

We are struggeling with some culture issues in one of our sites and we've narrowed it down to the SimpleAddress router.

Our use case:

We have domain.com/lang/rest/of/the/path language routing, i.e. different languages on same domain. The master language is se. Now, if we are on another language than master and are firing an AJAX request to a MVC routed controller (domain.com/controller/action etc), we won't have the correct culture and need to correct that. So we create a HttpModule and set ContentLanguage.PreferredCulture to the correct culture early on.

Our problem:

The SimpleAddress router will try to look for a content that matches the url and when it does, it will route to that content and set the language to the language branch of the routed content. However, when the router doesn't find any matches for the URL, it still seems to set the lanage to the routed content. Since there isn't any routed content, it will set the language to null and the setter will save it as the master language instead of null. So even if we tell the current request it should be culture nb-NO, the simple address route will reset it to the default language, regardless if it found any match or no.

Suggested solution:

I understand that the SimpleAddress route needs to change the language if it matches a content in a language that isn't the current routed language. But when it doesn't find a match, it shouldn't set the language to 'null', overriding any previous value. It should do nothing, as it found no match.

I'm sure I don't have the whole story, all of this is happening deep into internal epi classes, but a current working workaround is to disable SimpleAddress route (Link to code we used).

#203505
Apr 25, 2019 14:51
* 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.