By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,054 Members | 1,635 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,054 IT Pros & Developers. It's quick & easy.

Missing data in cookie

P: n/a
I have a record set (rs) that contains 25 barcodes values that I set to true
in a cookie. (see code section below)

If I read the cookie from within the same page that created it, I see all
25 values. But if I redirect to another page and read the cookie only 18 of
the values remain.

Even though I load the same 25 barcodes at login, the 18 that remain can
differ each time.

If anyone can help figure out why I am missing data in the cookie, I would
appreciated it. The cookie size is only 2k.

Here is the section of code i am using to create the cookie. Hopefully, I
did not make any typos when I retyped it.

while not rs.eof
response.cookies(cstr(rs("code"))) = "true"
response.cookies(cstr(rs("code"))).expires = dateadd("d",1,date)
rs movenext
wend

Here is the section of code i am using to view the cookie.

for each cookie in Request.cookies
if not request.cookies(cookie).haskeys then
response.write "<br>"
response.write cookie + " = " + request.cookies(cookie)
else
for each key in request.cookies(cookie)
response.write "<br>"
response.write cookie + "( "+ key + ") = " +
request.cookies(cookie)(key)
next
end if
next
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> Here is the section of code i am using to create the cookie. Hopefully, I
did not make any typos when I retyped it.
Are your Ctrl, C or V keys broken?
while not rs.eof
response.cookies(cstr(rs("code"))) = "true"
response.cookies(cstr(rs("code"))).expires = dateadd("d",1,date)
rs movenext
wend

Here is the section of code i am using to view the cookie.

for each cookie in Request.cookies
if not request.cookies(cookie).haskeys then
response.write "<br>"
response.write cookie + " = " + request.cookies(cookie)
else
for each key in request.cookies(cookie)
response.write "<br>"
response.write cookie + "( "+ key + ") = " +
request.cookies(cookie)(key)
next
end if
next


I will try this tomorrow when I'm on a PC but it looks like it should work.
In other words, on casual inspection, I can't see why 7 of the codes would
randomly disappear.

A

Jul 22 '05 #2

P: n/a
when you say the data is only 2k, are you also taking into account the
cookies keys (names) and the expires date?

anyway, I'd recommend you keep the amount of data in the coookie to an
absolute minimum and use an alternative, say Session variables, or persisted
data in a DB, or application/session-scope FreeThreadedDomDocuments if you
want to persist bigger chunks of data
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no
rights.

"Wally" <Wa***@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
I have a record set (rs) that contains 25 barcodes values that I set to
true
in a cookie. (see code section below)

If I read the cookie from within the same page that created it, I see all
25 values. But if I redirect to another page and read the cookie only 18
of
the values remain.

Even though I load the same 25 barcodes at login, the 18 that remain can
differ each time.

If anyone can help figure out why I am missing data in the cookie, I would
appreciated it. The cookie size is only 2k.

Here is the section of code i am using to create the cookie. Hopefully, I
did not make any typos when I retyped it.

while not rs.eof
response.cookies(cstr(rs("code"))) = "true"
response.cookies(cstr(rs("code"))).expires = dateadd("d",1,date)
rs movenext
wend

Here is the section of code i am using to view the cookie.

for each cookie in Request.cookies
if not request.cookies(cookie).haskeys then
response.write "<br>"
response.write cookie + " = " + request.cookies(cookie)
else
for each key in request.cookies(cookie)
response.write "<br>"
response.write cookie + "( "+ key + ") = " +
request.cookies(cookie)(key)
next
end if
next

Jul 22 '05 #3

P: n/a
Using windows explorer the cookie file size shows as 2k.

This is existing code that I have inherited. I have suggested using session
variables to my client, but this would require code changes in 30 or more asp
pages and he wants me to spend a little more time trying to find this bug.
"Jason Brown [MSFT]" wrote:
when you say the data is only 2k, are you also taking into account the
cookies keys (names) and the expires date?

anyway, I'd recommend you keep the amount of data in the coookie to an
absolute minimum and use an alternative, say Session variables, or persisted
data in a DB, or application/session-scope FreeThreadedDomDocuments if you
want to persist bigger chunks of data
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no
rights.

"Wally" <Wa***@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
I have a record set (rs) that contains 25 barcodes values that I set to
true
in a cookie. (see code section below)

If I read the cookie from within the same page that created it, I see all
25 values. But if I redirect to another page and read the cookie only 18
of
the values remain.

Even though I load the same 25 barcodes at login, the 18 that remain can
differ each time.

If anyone can help figure out why I am missing data in the cookie, I would
appreciated it. The cookie size is only 2k.

Here is the section of code i am using to create the cookie. Hopefully, I
did not make any typos when I retyped it.

while not rs.eof
response.cookies(cstr(rs("code"))) = "true"
response.cookies(cstr(rs("code"))).expires = dateadd("d",1,date)
rs movenext
wend

Here is the section of code i am using to view the cookie.

for each cookie in Request.cookies
if not request.cookies(cookie).haskeys then
response.write "<br>"
response.write cookie + " = " + request.cookies(cookie)
else
for each key in request.cookies(cookie)
response.write "<br>"
response.write cookie + "( "+ key + ") = " +
request.cookies(cookie)(key)
next
end if
next


Jul 22 '05 #4

P: n/a
Wally wrote:
I have a record set (rs) that contains 25 barcodes values that I set
to true in a cookie. (see code section below)

If I read the cookie from within the same page that created it, I
see all 25 values. But if I redirect to another page and read the
cookie only 18 of the values remain.

Even though I load the same 25 barcodes at login, the 18 that remain
can differ each time.


Have you confirmed this with any other browser, or just with IE?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.