I've read dozens of articles and solutions on persisting a selected value of a DropDownList. None of the articles seem to address my need exactly. Here is my requirement:
I have a DropDownList in _Layout.cshtml (sitewide page header) that allows a user to select their desired language.
<form>
<select id="lang">
<option value="en-US" selected="selected">English</option>
<option value="fr-CA">Français</option>
<option value="pt-BR">Português</option>
<option value="es-MX">Español</option>
</select>
</form>
My intention is to use the Westwind.Globalization package (NuGet) to perform localization.
By default the setting should be English, but when a user makes a selection from the language dropdown I want to persist their selection to a cookie which will be used for not only for the current session but also on return visits.
If the user is authenticated I will also want to save their selection in their user profile which I have already added a column for.
What is the best practice for persisting a value for the current session, return visits, and to save to the user's profile if they are authenticated when the desired language is changed?