470,596 Members | 1,574 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

A Cookie Error is a Sometimes Thing

Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?
Thanks.
Sep 14 '07 #1
2 3144
"Pupkin" <sp*******@dorrk.comwrote in message
news:MP***********************@news.giganews.com.. .
Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?

The cookie is the object retrevied with Cookies("CKName"). ("ED") is a value
with in the cookie and returns a string.
Cookies can be multivalued which what you appear to be using but you can
only expire the cookie as whole not an individual value. This code should
perhaps be:-

Response.Cookies("CKName").Expires = Date + 3650
--
Anthony Jones - MVP ASP/ASP.NET
..
Sep 14 '07 #2
In article <#1**************@TK2MSFTNGP03.phx.gbl>, An*@yadayadayada.com
says...
"Pupkin" <sp*******@dorrk.comwrote in message
news:MP***********************@news.giganews.com.. .
Hi,

I've a script that sets a cookie, but when I visit the page occasionally
get this error that goes away when I immediately refresh the page:

"Object doesn't support this property or method:
'Response.Cookies(...)"
Here's the code in question:

Response.Cookies("CKName")("ED").Expires = DATE + 3650
I've read elsewhere that the ".Expires" method is not supported, but
it's in most of the online cookie tutorials I've looked at, and, like I
said, it works when I refresh the page.

I also saw a comment on this board that this is not how you create a
permanent cookie with ASP. If not, then how?


The cookie is the object retrevied with Cookies("CKName"). ("ED") is a value
with in the cookie and returns a string.
Cookies can be multivalued which what you appear to be using but you can
only expire the cookie as whole not an individual value. This code should
perhaps be:-

Response.Cookies("CKName").Expires = Date + 3650

Great. That makes a lot of sense. Thanks!
Sep 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Jochen Daum | last post: by
1 post views Thread by Romain Perin | last post: by
9 posts views Thread by Peter Oliphant | last post: by
reply views Thread by Bantha | last post: by
1 post views Thread by Bobby Edward | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.