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.
Pupkin [ Fr, 14 September 2007 18:56 ] [ ID #1820571 ]

Re: A Cookie Error is a Sometimes Thing

"Pupkin" <spamagnet [at] dorrk.com> wrote in message
news:MPG.21545cfc2fda1499897e2 [at] 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
..
Anthony Jones [ Fr, 14 September 2007 19:19 ] [ ID #1820573 ]

Re: A Cookie Error is a Sometimes Thing

In article <#1uHmNv9HHA.4612 [at] TK2MSFTNGP03.phx.gbl>, Ant [at] yadayadayada.com
says...
> "Pupkin" <spamagnet [at] dorrk.com> wrote in message
> news:MPG.21545cfc2fda1499897e2 [at] 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!
Pupkin [ Fr, 14 September 2007 20:06 ] [ ID #1820574 ]
Webserver » microsoft.public.inetserver.asp.general » A Cookie Error is a Sometimes Thing

Vorheriges Thema: File Upload Office 2007 documents, file corrupt/cant open
Nächstes Thema: Test CDO Message Send Response