Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong culture on 404 page #225

Open
KolbeinFoldoy opened this issue Feb 4, 2022 · 3 comments
Open

Wrong culture on 404 page #225

KolbeinFoldoy opened this issue Feb 4, 2022 · 3 comments

Comments

@KolbeinFoldoy
Copy link

CurrentUICulture, CurrentCulture and PreferredCulture is the wrong language when rendering the 404 page. The main language on our sites are norwegian. When being on the english verison of the page and going to a page that doesn't exist (www.oursite.no/en/asdasd/) the various culture variables change to norwegian somehow. It doesn't work to manually set these to english in the error controller either as it seems to be overritten at a later stage.

The NotFoundPage is loaded correctly in english with an english 404 message, but the header, menu-links and footer is in norwegian. This seems to be due to @Html.Translate using CurrentUICulture to pick lang file.

On www.oursite.no/en/:
image

On www.oursite.no/en/asdasd (404):
image

@marisks
Copy link
Member

marisks commented Feb 9, 2022

Is your 404 page an Episerver page or just ASP.NET?

@KolbeinFoldoy
Copy link
Author

The correct english page created in Episerver is fetched in the error controller, stored in a view model which is returned like this:
return View("~/Views/Error/Error404.cshtml", viewModel);

@KolbeinFoldoy
Copy link
Author

Is this intended behavior? If not, do you get the same result if you write code for displaying the cultures? Also, do you know how to fix this? In some solutions, overwriting the cultures works, but for some other sites it does not, as it gets overwritten back again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants