Strange cookie behavior

A

AHN

Please tell me somebody what causes the cookie set with
<%
Response.Cookies("blah") = "Blah blah"
Response.Cookies("blah").Expires = DateAdd( "h", 1, Now() )
%>
work as supposed on my local server but fail on my site on Brinkster. On the
next page it disappears if used with "Expires" attribute set, and is there,
if without. It was working some time ago. I was forced to reinstall my OS
(W2k, IIS 5.0) since then and already a few days I have this problem.

Here is what iis help says:
"Expires Write-only. The date on which the cookie expires. This date must be
set in order for the cookie to be stored on the client's disk after the
session ends. If this attribute is not set to a date beyond the current
date, the cookie will expire when the session ends.
"
It does not say I can't set the cookie for one hour. What's wrong?
Thanks for any help.
 
A

AHN

No it is not. I had that thought but checked it already a few days ago.
Anything else?
 
A

AHN

Thanks. I feel so stupid.

Brian Staff said:
The Expires property on the Response object is a date - not a time...hence
it expires today.

from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/
ref_vbom_resoccook.asp?frame=true

Write-only. The date on which the Cookie expires. This date must be set
in order for the Cookie to be stored on the client's disk after the session
ends. If this attribute is not set to a date beyond the current date, the
Cookie expires
when the session ends.



Brian Staff

must
 
A

AHN

Don't think you're right. Just read;
``If this attribute is not set to a date beyond the current date, the Cookie
expires when the session ends."
I could expect that it will be written, and thrown out with the end of the
session. Besides, its not logical, and also it WORKS on my local server as
its supposed to. The different timezone idea takes more water, but
<%Response.Write Now()%> returns the correct time from the big server out
there.
Thanks anyway. I found another way. I set the cookie and then keep track of
the time in some other file, which refreshes itself every 15 secs. As soon
as the hour is over, I kill the cookie with my bare hands. :)
Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,220
Latest member
AugustinaJ

Latest Threads

Top