Hi All,
I'm a bit confused. I simply try to create a new Cookie. And Update my
cookie later when another call is made to my Page. The cookie creation
works properly, but the update does not work at all. I'm probably
missing something but I can't find what. Any help will be really
appreciated.
Here is the Code I execute to Create my Cookie:
HttpCookie httpCookie = new HttpCookie("MyCookie");
httpCookie.Expires = DateTime.Now.AddDays(30);
httpCookie.Path = "/";
httpCookie.Value = "MyInitValue";
Response.Cookies.Add(httpCookie);
If I call back the Page and check what is in
Request.Cookies["MyCookie"].Value it returns "MyInitValue".
Now I try to update the cookie here is the code:
Response.Cookies.Set(Request.Cookies["MyCookie"]);
Response.Cookies["NewBasket"].Value = "MyNewValue";
Response.Cookies["NewBasket"].Expires = DateTime.Now.AddDays(30);
After this code is executed when I check
Request.Cookies["MyCookie"].Value it returns always "MyInitValue".
Can anybody see what I'm missing ?
I will appreciate your help.
Kind regards.
Sébastien.