I have an <asp:CheckBox OnClick=""> set to a JavaScript function that performs the following:
document.cookie = "cv0_value=1";
I am checking this value within the .Net code-behind in the following manner and all appears to be working fine.
cv0_value = Request.Cookies["cv0_value"].Value == "0" ? false : true;
The issue is that when I attempt to later reset the value in the .Net code-behind it does not appear to affect the cookie.
HttpContext.Current.Request.Cookies["cv0_value"].Value = "0";
When checking the value again in the code-behind I find that it is still set to the original value set in the JavaScript.
I have also tried to repeatedly call the Page_Load method, checking the Request and Response. Despite setting the Response with the updated value when the Page_Load is called again the Request contains the original value.
As discussed in the comments below I believed the issue may be due to referencing from a static method but I found that this addresses the issue. Since I am already referring to HttpContext.Current.Response it does not appear to be the problem in my instance.
Can someone explain what might be going on?