ultraman Posted March 14, 2005 Posted March 14, 2005 Hi all ! According to this MSDN article, to modify an existing subkey in a cookie, you just do this : Response.Cookies("userInfo")("lastVisit") = DateTime.Now.ToString Response.Cookies("userInfo").Expires = DateTime.Now.AddDays(1) The problem is.... it destroys all other subkeys. Actualy, it seems like it deletes the cookie and recreate a new one. So, is there an easy way to modify a subkey in a cookie or do I have to copy all values from the Request cookie inside the Response cookie before changing the Expires date ? Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
ultraman Posted March 17, 2005 Author Posted March 17, 2005 For those who might be interested, it was just a question of first getting the cookie from the Request object. After you get this, you modify the value and add this new cookie to the Response object. Dim cookie As HttpCookie = Request.Cookies("MyPOS") cookie("CliID") = strInfo(0) cookie("CliName") = strInfo(1) cookie("Address") = strInfo(2) cookie.Expires = DateTime.Now.AddDays(365) Response.Cookies.Add(cookie) Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.