There is an ambiguity in your question.
When you say
"later in the program,
i wanted to change the cookie value...",
it is not clear whether you mean
during the same page load
or during a later page load.
If you are trying to change the cookie during the same
page load, you can do that by changing what you plan to
send in the HTTP header. But once the header has been sent,
you cannot backtrack during the processing of that page
and change what was sent in the header.
On the other hand, if you want to change the value of
the cookie while processing a later page request, the
advice given in the other responses is correct.
Just write right over the previous cookie with the
identical path and cookie name but with a new value.
Note also, when you say,
"It is setting the new value, but its pulling back
the old one when I display it to the screen" it would
help us to help you if you told us:
- why you think it is setting the new value
(how did you confirm that),
- how you are grabbing the value for re-display.
The devil is in the details and if you are uncertain
about what is going wrong, distrust your narrative
description of what is happening and show us the code
and/or the output.
HTH, david | [reply] |
You just set the cookie like you were setting a new one. Just make sure that the path matches, and the old cookie should be overwritten. | [reply] |
Ive tried this, but it seems to retain the old value :(
| [reply] |
You need to make sure that everything except the value and/or exiration time is the same. I just tried it using IIS with IE and Netscape and it works for me.
| [reply] |
| [reply] |
This is really weird
It is setting the new value, but its pulling back the old one when I display it to the screen??
| [reply] |