What's the ID of a cookie?
is it possible to have two coo开发者_Python百科kies with the same
- Name
- Host and
- Path
For example:
cookie #1
name=.ASPXAUTH
content: D06BB....
Host: www.mydomain.com
Path:/
Expires: 2-12-2015
cookie #2
name=.ASPXAUTH
content: 46458....
Host: www.mydomain.com
Path:/
Expires: 2-12-2016
So my question: if is technically possible to have both of these two cookies at the same time?
No, setting cookie #2
would overwrite cookie #1
since they have the same name.
If what you propose was indeed possible, it would be impossible to change the value of an existing cookie, because doing so would create a new cookie.
Multiple cookie name/value pairs can exist as long as the path is different (or the domain obviously). You can refer to RFC 2109 for more details.
精彩评论