Thanks for your explanation. It is clear what you want to achieve.
Given your requirements, here are some suggestions:
@ZNB : ... a multi-language session-based version (<set session.lg = "en">)....The user has the possibility to choose his language when entering the site by clicking on a flag which toggles the session.lg according to the language.
A custom session variable, such as session.lg, is stored in memory. That is, on the server. Hence, not as a cookie on the client. Therefore, if there is no change when the user clicks on the flag, it will mean that the application failed to update the value of session.lg.
One hypothesis is that, during the switch from one user to the next, the session stayed the same. By manually clearing the cookies you then forced ColdFusion to start a new session. I am assuming that you want a new session to start whenever a user clicks on a language flag.
Should this hypothesis be correct, I would implement the language requirement as follows:
1. Implement the login code right after you validate a successful user-login:
<cflogin>
<cfloginuser name = "bkbk" password = "bkbk-pw" roles = "user">
</cflogin>
2. Configure the application to store the user's login information in the session scope:
<!--- in Application.cfc --->
<cfset this.name = "AppName">
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0,0,20,0)>
<cfset this.loginStorage="session">
3. Implement the logout code right after you log the user out:
<cflogout>
4. When a user clicks on the language flag:
<!--- Include code to log the user out --->
<!--- Code to invalidate the session --->
<cfset sessionInvalidate()>
<!--- Code to reset the language --->
<cfset session.lg="fr">
<!--- Include code to log the user in --->
5. When a user clicks on the country flag:
<!--- Include code to log the user out --->
<!--- Code to invalidate the session --->
<cfset sessionInvalidate()>
<!--- Code (query) to get the language, based on the country. For example, "fr" for France or Senegal --->
...
<!--- Code to reset the language --->
<cfset session.lg="fr">
<!--- Include code to log the user in --->
Merci pour votre retour.
C'est exactement ce que je voulais.
Thanks for your feedback.
That's exactly what I wanted.