[Top][All Lists]

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

[help-cgicc] Changing a cookie value

From: Derek Ealy
Subject: [help-cgicc] Changing a cookie value
Date: Fri, 08 Nov 2002 10:01:38 -0800


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...
   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*

reply via email to

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