help-cgicc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-cgicc] Changing a cookie value


From: Alexander J. Oss
Subject: Re: [help-cgicc] Changing a cookie value
Date: Sat, 9 Nov 2002 12:04:22 -0500

I'm pretty sure that once you set a cookie, it's not your environment in
which it's set--it's your client's browser's environment.  So unless you
wait for the cookie to expire in the browser, the browser's required to
continue to return it to your web server.

Perhaps instead of changing the cookie value itself, you should use a cookie
with a value that identifies information you keep on the web server (e.g. on
a database), and when you need to change information, you change the
database.  I believe this is a very common approach.

Hope that helps!

----- Original Message -----
From: "Derek Ealy" <address@hidden>
To: <address@hidden>
Sent: Friday, November 08, 2002 1:01 PM
Subject: [help-cgicc] Changing a cookie value


Hi,

I haven't been able to figure out how to change the value of a cookie in my
environment.

When my cgi is executed there are already a couple of cookie values in the
environment. In certain instances I need to change one of them. I have code
that looks like this right now:

    const CgiEnvironment& env = cgi.getEnvironment();

    vector<HTTPCookie> cookies = env.getCookieList();
    vector<HTTPCookie>::iterator itr;
    HTTPCookie cookie;
    for (itr = cookies.begin(); itr != cookies.end(); itr++) {
      if (itr->getName() == CALLING_URL_COOKIE)
cookie = *itr;
    } // end for (itr...
    cookie.setValue(strNewValue);
    cout << HTTPHTMLHeader().setCookie(cookie) << endl;

But it when it outputs the new header info there are now two calling URL
cookies, one with the old value and one with the new one.

Is there a way for me to delete the original cookie from the environment, or
preferably modify it?

Thanks, Derek



_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail



_______________________________________________
help-cgicc mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-cgicc





reply via email to

[Prev in Thread] Current Thread [Next in Thread]