473,320 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Changing cookie values

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("FirstN ame"))
cookie.Values.Add("UserLastName",dbReader("LastNam e"))
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
Nov 19 '05 #1
0 1451

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change...
0
by: pwldev | last post by:
Sorry if this isn't a good place for this question. I have a problem with losing cookie values whenever a user's local machine date/time is behind the date & time of the IIS machine. The login...
4
by: Wally | last post by:
I have a record set (rs) that contains 25 barcodes values that I set to true in a cookie. (see code section below) If I read the cookie from within the same page that created it, I see all 25...
6
by: Jason Collins | last post by:
There seems to be an inconsistency (bug?) in the way the Set-Cookie header is handled by the WebHeaderCollection. That is, the values of Set-Cookie, when an Expires is specified, contain the ","...
3
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code...
5
by: Miljana | last post by:
Hi, I have one problem with cookies in ASP.NET application. It seems that I can not retreive cookie from Request.Cookies collection. I put cookie in Response.Cookies collection, and after page...
1
by: William | last post by:
ERROR: Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. This if then statement only works if a cookie exists. It fails if the cookie...
1
by: CR1 | last post by:
I found a great cookie script below, but don't know how to make it also pass the values sent to the cookie, to a querystring as well for tracking purposes. Can anyone help? If there was a way to...
4
by: D. | last post by:
Hi, I defined some cookies in order to pass values between pages in my application. The problem is that when i request them with: cookie = Request.Cookies("mycookie") x = cookie.Value (suppose...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.