I hope someone can help with solution to this problem?
Currently my ASP.Net MVC website uses forms authentication is set up like this my web.config:
<authentication mode="Forms">
<forms loginUrl="en/User/Signin" timeout="2880" />
</authentication>
We have some routing rules that use the prefix /en/ in the url as a identifier for the language, but the problem is that if someone is visiting our french site http://www.web.com/fr/Secure/privateData, they are redirect to http://www.web.com/en/User/Signin, which in turn sets the culture to english. So after logging in, users may need to change there language back to french.
Not good!
So if the website need to suppurt more languages, so I need to do something like this in the web config:
<authentication mode="Forms">
<%if (isGerman()) { %>
<forms loginUrl="de/User/Signin" timeout="2880" />
<%} else if (isFrench()) {%>
<forms loginUrl="fr/User/Signin" timeout="2880" />
<%} else { %>
<forms loginUrl="en/User/Signin" timeout="2880" />
<% } %>
</authentication>
I know you can not have code in the web.config, but this is just to illustrate what I am trying to achieve. Could anyone provide a simple solution, or links to solutions they may already use?
Thanks alot!
Can’t you just globalize one login page and show the language strings depending on the language setting?
Otherwise you should use some kind of redirect, set one login page and redirect to the correct page depending on the language settings within that page. However you might need to add extra code to your config telling the system that the language versions of the login are not protected within the authentication mode (you can exclude/change settings for certain parts of the site in the web.config) to prevent endless looping.