Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Changing cookie values

Thread Tools

Changing cookie values

Posts: n/a
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("UserFirstName",dbReader("FirstN ame"))
cookie.Values.Add("UserLastName",dbReader("LastNam e"))
cookie.Expires = DateTime.MaxValue
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?



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is different between Request.Cookie and Response.Cookie ad ASP .Net 2 01-27-2006 12:54 PM
Cookie Question (IP as domain and cookie file location) =?Utf-8?B?UGF1bA==?= ASP .Net 1 01-10-2006 08:37 PM
Any downsides to cookie assignment inside custom class using HttpContext.Current? ASP.NET 2.0 cookie fix? ASP .Net 2 08-17-2005 06:43 AM
Cookie and Session Cookie Questions. Shapper ASP .Net 1 04-27-2005 11:20 AM
Session cookie? Browser instance cookie? Ben ASP .Net 3 06-03-2004 03:41 AM