Cookie写过 [英] Cookie Over Write

查看:66
本文介绍了Cookie写过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我创建一个名为myCompany的cookie并存储多个值,如userLast

和userFirst,然后又想添加一个新的名称对,例如

userPreference1,可以我附加了新的名字对而没有重写

userLast和userFirst名字对?


换句话说,新的名字对是相同的cookie超过写其他

现有密钥?


代码:

Response.Cookies(" myCompany")(" ; userLast")= Session(" userLast")

Response.Cookies(" myCompany")(" userFirst")= Session(" userFirst")

>
代码2:

Response.Cookies(" myCompany")(" userPreference1")=

会话(" userPreference1")

if i create a cookie named myCompany and store several values like userLast
and userFirst and then later want to add a new name-pair such as
userPreference1, can i append the new name-pair without re-writing the
userLast and userFirst name-pairs?

In other words, does a new name-pair to the same cookie over write other
existing keys?

CODE:
Response.Cookies("myCompany")("userLast") = Session("userLast")
Response.Cookies("myCompany")("userFirst") = Session("userFirst")

CODE 2:
Response.Cookies("myCompany")("userPreference1") =
Session("userPreference1")

推荐答案

我很确定你每次更改cookie中的任何键都需要

重写它们或者你将丢失钥匙,你没有设置。

这就是他们工作的方式。


" Scott" < SB ***** @ mileslumber.com>写在消息

新闻:uV ************** @ TK2MSFTNGP12.phx.gbl ...
I am pretty sure every time you change any Key in the cookie you have to
rewrite them all or you will lose the key you don''t set.
It is just the way they work.

"Scott" <sb*****@mileslumber.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
如果我创建一个cookie命名myCompany并存储几个值,如
userLast和userFirst,然后想要添加一个新的名称对,例如
userPreference1,我可以追加新的名字对而无需重新编写
userLast和userFirst name-pairs?

换句话说,同一个cookie的新名称对是否写过其他现有的键?

代码:<响应.Cookies(" myCompany")(" userLast")= Session(" userLast")
Response.Cookies(" myCompany")(" userFirst")= Session(") userFirst")

代码2:
Response.Cookies(" myCompany")(" userPreference1")=
会话(" userPreference1")
if i create a cookie named myCompany and store several values like
userLast and userFirst and then later want to add a new name-pair such as
userPreference1, can i append the new name-pair without re-writing the
userLast and userFirst name-pairs?

In other words, does a new name-pair to the same cookie over write other
existing keys?

CODE:
Response.Cookies("myCompany")("userLast") = Session("userLast")
Response.Cookies("myCompany")("userFirst") = Session("userFirst")

CODE 2:
Response.Cookies("myCompany")("userPreference1") =
Session("userPreference1")



Kyle Peterson于2006年1月4日在

microsoft.public.inetserver.asp.general写道:
Kyle Peterson wrote on 04 jan 2006 in
microsoft.public.inetserver.asp.general:
斯科特 < SB ***** @ mileslumber.com>在消息中写道
新闻:uV ************** @ TK2MSFTNGP12.phx.gbl ...
"Scott" <sb*****@mileslumber.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
如果我创建一个名为myCompany和store的cookie几个值如
userLast和userFirst然后想要添加一个新的名称对
如userPreference1,我可以追加新的名字对而无需重新编写userLast和userFirst名称-pairs?

换句话说,是否有一个新的名字对于同一个cookie写了
其他现有的密钥?

代码:
响应.Cookies(myCompany)(userLast)= Session(userLast)
Response.Cookies(myCompany)(userFirst)= Session(userFirst)<问题2:
Response.Cookies(" myCompany")(" userPreference1")=
会话(" userPreference1")
if i create a cookie named myCompany and store several values like
userLast and userFirst and then later want to add a new name-pair
such as userPreference1, can i append the new name-pair without
re-writing the userLast and userFirst name-pairs?

In other words, does a new name-pair to the same cookie over write
other existing keys?

CODE:
Response.Cookies("myCompany")("userLast") = Session("userLast")
Response.Cookies("myCompany")("userFirst") = Session("userFirst")

CODE 2:
Response.Cookies("myCompany")("userPreference1") =
Session("userPreference1")


我我很确定你每次更改cookie中的任何键都要重写它们,否则你将丢失你没有设置的键。
它只是他们工作的方式。


I am pretty sure every time you change any Key in the cookie you have
to rewrite them all or you will lose the key you don''t set.
It is just the way they work.




不正确。

但为什么要问?

这样的事情是如此易于测试:


========== test1.asp ==========


<%

Response.Cookies(" myCompany")(" 1")=" x1"

Response.Cookies(" myCompany")( " 2")=" x2"

%>

< a href =''test2.asp''>转到test2.asp< / a>


========== test2.asp ==========


< ;%

Response.Cookies(" myCompany")(" 3")=" x3"

%>


< br><%= Request.Cookies(" myCompany")(" 1")%>

< br><%= Request.Cookies(" ; myCompany")(" 2"%>

< br><%= Request.Cookies(" myCompany")(" 3")%>


========= test2.asp显示:


x1

x2

x3

-

Evertjan。

荷兰。

(请将x''改为点我的电子邮件地址)



Not true.
But why ask?
Such things are so easy to test:

========== test1.asp ==========

<%
Response.Cookies("myCompany")("1") = "x1"
Response.Cookies("myCompany")("2") = "x2"
%>
<a href =''test2.asp''>go to test2.asp</a>

========== test2.asp ==========

<%
Response.Cookies("myCompany")("3") = "x3"
%>

<br><%=Request.Cookies("myCompany")("1")%>
<br><%=Request.Cookies("myCompany")("2")%>
<br><%=Request.Cookies("myCompany")("3")%>

========= test2.asp shows:

x1
x2
x3
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


谢谢。


Evertjan。 <前************** @ interxnl.net>在消息中写道

news:Xn ******************* @ 194.109.133.242 ...
thanks.

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.242...
Kyle Peterson 2006年1月4日在
microsoft.public.inetserver.asp.general中写道:
Kyle Peterson wrote on 04 jan 2006 in
microsoft.public.inetserver.asp.general:
" Scott" < SB ***** @ mileslumber.com>在消息中写道
新闻:uV ************** @ TK2MSFTNGP12.phx.gbl ...
"Scott" <sb*****@mileslumber.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
如果我创建一个名为myCompany和store的cookie几个值如
userLast和userFirst然后想要添加一个新的名称对
如userPreference1,我可以追加新的名字对而无需重新编写userLast和userFirst名称-pairs?

换句话说,是否有一个新的名字对于同一个cookie写了
其他现有的密钥?

代码:
响应.Cookies(myCompany)(userLast)= Session(userLast)
Response.Cookies(myCompany)(userFirst)= Session(userFirst)<问题2:
Response.Cookies(" myCompany")(" userPreference1")=
会话(" userPreference1")
if i create a cookie named myCompany and store several values like
userLast and userFirst and then later want to add a new name-pair
such as userPreference1, can i append the new name-pair without
re-writing the userLast and userFirst name-pairs?

In other words, does a new name-pair to the same cookie over write
other existing keys?

CODE:
Response.Cookies("myCompany")("userLast") = Session("userLast")
Response.Cookies("myCompany")("userFirst") = Session("userFirst")

CODE 2:
Response.Cookies("myCompany")("userPreference1") =
Session("userPreference1")


我我很确定你每次更改cookie中的任何键都要重写它们,否则你将丢失你没有设置的键。
它只是他们工作的方式。


I am pretty sure every time you change any Key in the cookie you have
to rewrite them all or you will lose the key you don''t set.
It is just the way they work.



不正确。
但为什么要问?
这样的事情很容易测试:

========== test1.asp ==========

<%
Response.Cookies(" myCompany")(" 1")=" x1"
Response.Cookies(" myCompany")(" 2")=" x2"
%>
< a href ='' test2.asp''>转到test2.asp< / a>

========== test2.asp ==========

<%
Response.Cookies(" myCompany")(" 3")=" x3"
%>

< br> ;<%= Request.Cookies(" myCompany")(" 1")%>
< br><%= Request.Cookies(" myCompany")(" 2") %>
< br><%= Request.Cookies(" myCompany")(" 3")%>

========= test2.asp显示:

x1
x3

-
Evertjan。
荷兰。(请在我的电子邮件中将x''更改为点laddress)



Not true.
But why ask?
Such things are so easy to test:

========== test1.asp ==========

<%
Response.Cookies("myCompany")("1") = "x1"
Response.Cookies("myCompany")("2") = "x2"
%>
<a href =''test2.asp''>go to test2.asp</a>

========== test2.asp ==========

<%
Response.Cookies("myCompany")("3") = "x3"
%>

<br><%=Request.Cookies("myCompany")("1")%>
<br><%=Request.Cookies("myCompany")("2")%>
<br><%=Request.Cookies("myCompany")("3")%>

========= test2.asp shows:

x1
x2
x3
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)



这篇关于Cookie写过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆