1.) Create Cookie with 2 values:
HttpCookie cookie = new HttpCookie("myCookie");
cookie["userid"] = "myid";
cookie["password"] = "pwd";
Request.Cookies.Add(cookie);
*Note. Storing a password in a cookie is generally not a good idea.
However, there may be times when this does need to be done. If you need to
strore the users password in a cookie, then you should encrypt (hash) the
password before storing it in the cookie or encrypt the entire cookie. Just
a suggestion :) If you need help with the encryption aspect, shoot me an
email.
2) Add values to an existing cookie
HttpCookie cookie = Request.Cookies["myCookie"];
cookie["newKey"] = "newValue";
Request.Cookies.Add(cookie);
Dave
dmy75252[removethis]@yahoo.com
"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Hello,
I need to know how to do 2 things:
1. CREATE a NEW cookie with 2 values: "password" and "user".
2. APPEND 2 new values to an ALLREADY EXISTING cookie.
I created a code which is working:
Dim cookie As HttpCookie = New HttpCookie("MyCookie")
cookie.Values.Add("culture", "pt-PT")
cookie.Expires = #01/01/2010#
Response.Cookies.Add(cookie)
I don't understand what code changes should I implement from (1) to (2).
Can someone help me?
Thank You,
Miguel