I created 2 separate page that uses cookies for auto login. But if I login both of them and if i refresh one of the page , I can see that site recognize the other cookie. Like if I print in both site user name to screen , after refresh I see the same user name in both site. I am running 2 sites in my localhost. And I did not specify location for cookie.
A:
I guess you're using the same key for both pages.
Cookies are stored by browsers per server or domain. For different paths, cookies with same names can have different values.
In your case, if you're using the same key for both login pages then in every request to your local web server, the value of that cookie will be the one which was last set by one of the pages if you omit path and domain when cookie is created.
You can use different names for the cookies to solve your problem or different paths for your cookies.
Zafer
2010-09-07 23:46:22
you can have 2 cookies with the same name with different paths.
Sabeen Malik
2010-09-07 23:48:20
@Sabeen: You're right. I've added that to my post.
Zafer
2010-09-08 00:00:46