I use the popular jquery cookie plugin to set session cookie value using javascript:
function ChangeLoginUser(sel) { var selectedUser = sel.options[sel.selectedIndex].value; $.cookie("LoginUser", selectedUser); location.reload(true); //refresh }
This function is called after the user selects a site from the drop-down list with the global drop-down list.
CookieName = value2 CookieName = value1
I do not understand why this is happening. I need to save only one cookie of this name. The new value should replace the old.
Ok. , cookie. URL- cookie . , :
$.cookie("LoginUser", selectedUser, { path: '/' });
, , :
$.cookie("LoginUser", selectedUser, { path: AppPath });
AppPath
<script type="text/javascript"> var AppPath = '@Url.Content("~/")' </script>