Link to home
Start Free TrialLog in
Avatar of eladr
eladr

asked on

asp and cookies

i saved a cookie :
Response.Cookies ("transp")("emp_id") = "999"
Response.Cookies ("transp").Expires = DATE + 365

when i tried to retrieve the information
in other page the cookie was empty
i tried to retrieve it by:

cookie_emp_id=request.cookies("transp")("emp_id")

response.write cookie_emp_id

what to do?
Avatar of jkunal
jkunal
Flag of India image

Response.Cookies("transp").Expires = Now + CDbl(365)
Avatar of eladr
eladr

ASKER

not working...
the cookie is "living" only in the same page.
the strangest thing is that was
working well yesterday
are dates not stored as milliseconds?

If so, adding 365 will be adding just under half a second to the expiry date.

could this be the problem?
daveamour:
no, this is how to create a cookie with 5 days expritarion:

Response.Cookies("mycookie").Expires
= date + (365*5)

xabi
Try this:

Response.Cookies("transp").Path = "/"

xabi
Avatar of eladr

ASKER

it's strange...
i changed the name of the cookie and everything is good now.
is someone has an idea?
i dont want it to happened again with
my new name.

elad
Try it. And say what do you get?

<%
Response.Write Request.Cookies ("transp")
Response.Cookies ("transp").Expires = -1
%>
Avatar of eladr

ASKER

this is the error:
Cookies object error 'ASP 0200 : 80004005'

Out of Range 'Expires' attribute

/orange/sa.asp, line 3

The date given for 'Expires' precedes Jan 1, 1980 or excedes Jan 19, 2038, 3:14:07 GMT.
Sorry
<%
Response.Write Request.Cookies ("transp")
Response.Cookies ("transp").Expires = Now()
%>
and try your code
ASKER CERTIFIED SOLUTION
Avatar of cybotto
cybotto

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial