cookie 的 ID 是什么?
是否可以有两个具有相同
- 名称
- 主机和
- 路径的
cookie例如:
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
所以我的问题:技术上是否可以同时拥有这两个同时吃两个饼干?
is it possible to have two cookies 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,设置
cookie #2
会覆盖cookie #1
,因为它们具有相同的名称。如果您的建议确实可行,则不可能更改现有 cookie 的值,因为这样做会创建一个新的 cookie。
只要路径不同(或者显然是域),就可以存在多个 cookie 名称/值对。您可以参考 RFC 2109 了解更多详细信息。
No, setting
cookie #2
would overwritecookie #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.