I'm doing the following to set a cookie value:
HttpCookie mycookie = new HttpCookie("mycookie");
mycookie.Value = "value1"; // Case sensitivity
mycookie.Expires = DateTime.Now.Add(1);
HttpContext.Current.Response.Cookies.Add(mycookie);
Sometime later, I check the cookie using:
HttpCookie mycookie = HttpContext.Current.Request.Cookies["mycookie"];
I notice it still has an older value:
mycookie.Value == "oldValue"
I can even check the cookie immediately after setting it and the value I've set isn't there. It's still the old value.
What is happening that the value isn't being set and how can I set it???