Changing cookie values

T

tshad

I can add a cookie fine, but I can't seem to figure out how to change the
value of a cookie and save it back.

My code looks like:

if (passwordSaveCookie.checked) then
If Request.Cookies("User") is nothing Then
Dim cookie As New HttpCookie("User")
cookie.Values.Add("UserName",UserName.Text)
cookie.Values.Add("UserFirstName",dbReader("FirstName"))
cookie.Values.Add("UserLastName",dbReader("LastName"))
cookie.Expires = DateTime.MaxValue
Response.AppendCookie(cookie)
else
Dim cookie As HTTPCookie = Request.Cookies("User")
cookie.Values("UserName") = UserName.Text
cookie.Values("UserFirstName") = dbReader("FirstName")
cookie.Values("UserLastName") = dbReader("LastName")
End If
end if


I don't get any errors, but when I close my browser and start it back up
again, the old values are now back.

If you create the cookie, you use "Response.AppendCookie".

Is there a corresponding call for updating a current cookie?

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top