My client is using IE9 and the server is asp.net (specifically a SharePoint application page).
Within the Page_Load
method of a page, I implemented the following code:
Response.Cookies["XXXXX"].Value = tabtitles.IndexOf(Request.Params["tab"]).ToString();
Response.Cookies["XXXXX"].Expires = DateTime.Now.AddDays(1);
Despite my cookie logic not behaving as expected, after inspecting the console in IE Developer Tools, I discovered that the value of document.cookie
was:
>> document.cookie
"XXXXX=3; WSS_KeepSessionAuthenticated={7da6dcd3-28b6-4c8f-b507-6fa80a16143c}; databaseBtnText=Open%20with%20Access; databaseBtnDesc=Works%20with%20items%20in%20a%20Microsoft%20Access%20database%2E; XXXXX=7"
It seems that the cookie was appended to the end of document.cookie
instead of being replaced. Could this be a bug in IE9? How can I correctly set and retrieve the desired cookie?