What to do when there are two cookies with the same name in IE7?

前端 未结 2 1233
刺人心
刺人心 2021-01-13 23:52

Some background:

CakePHP writes it\'s own session id cookie besides the PHPSESSID. This is used to authenticate a request. Then an SWFupload sends a file, and that t

2条回答
  •  清歌不尽
    2021-01-14 00:08

    Two cookies may have the same name if they were set for different domains or paths.

    For instance, if you set a cookie "ID" on "www.example.com" and also on "example.com", then two ID cookies will be sent for every request for "www.example.com" or "anything.www.example.com".

    To prevent this, ensure that you're consistently setting cookies for the same domain, and if you happen to have multiple domain names aliased to the same server (e.g. www.example.com and example.com) then have one redirect to the other.

    Similarly, don't set cookies of the same name with a different path value.

提交回复
热议问题