Generally, it's a bad idea to have multiple cookies with the same name on one site. It causes a lot of confusion, as you are discovering. One thing you can do, if your programs have different paths, is to limit the path info in the cookie as carefully as possible, to avoid overlap or overwriting (think of it as scoping for cookies).
The real solution, though, is to thoroughly examine the reason for your cookies and determine what happened with your implementation. If every single page on your site sets a login cookie, for example, then this is really a poor implementation.
Another strategy is to check for the cookie before setting another one. And remember, the cookie specification only allows for 20 cookies per server or domain. While a browser might accept more, you should assume the lowest common denominator. If you try to set that 21st cookie, the 1st will be lost.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: Seeking help to avoid duplicate cookies
by Ovid
in thread Seeking help to avoid duplicate cookies
by JK_Bean
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |