After login, in home/index
, urls localization is inconsistent.
This is a solution (ASP.NET Core 2.2) that displays the problem
https://github.com/bonioloa/AspCoreLocalizedSite
Localization code is in the BaseController
, Globalfilter
, Setup
. You can input any value on the field on Login page.
Localization should work by url and if you manually change it (example: localhost/it/Home/Index to localhost/en/Home/Index ) and then navigate with enter, I expect that all links generated in page will have a path starting with "en".
If you check source html of this page you can see that Home/Index have the correct path (/en/Home/Index) but Privacy and Logout paths start with the wrong language (/it/), all links are generated with the same asp tag (see _layout.cshtml view)
so after a good night sleep I changed approach and I finally noticed one thing:
SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
this directive was breaking localization routing for the first version of my code implemented using this articles
failing to realize that compatibility setting was the root of the problem i made a custom solution that was utterly bugged. Warning: that this setting is shipped with the default ASP.NET Core 2.2 blank solution by visual studio.
I deleted the repository and I recommend to use the template provided in the linked articles.