I am using the popular jquery cookie plugin to set a session cookie value via javascript like so:
function ChangeLoginUser(sel) {
var selectedUser = sel.options[sel.selectedIndex].value;
$.cookie("LoginUser", selectedUser);
location.reload(true); //refresh
}
This function is called after user selects from a site global drop-down box option.
- Change the value on page1 - the cookie is set CookieName = Value1.
- Go to page2 - The cookie is persisting correctly
- Change the drop-down value to value2 - Fiddler now shows two cookies by the same name with both values like this:
CookieName = value2 CookieName = value1
I don't understand why this is happening. I need to keep only one cookie of this name. The new value is supposed to replace the old one.