Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

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?
0
eladr
Asked:
eladr
  • 3
  • 2
  • 2
  • +3
1 Solution
 
jkunalCommented:
Response.Cookies("transp").Expires = Now + CDbl(365)
0
 
eladrAuthor Commented:
not working...
the cookie is "living" only in the same page.
the strangest thing is that was
working well yesterday
0
 
daveamourCommented:
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?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
xabiCommented:
daveamour:
no, this is how to create a cookie with 5 days expritarion:

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

xabi
0
 
xabiCommented:
Try this:

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

xabi
0
 
eladrAuthor Commented:
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
0
 
Yury_DelendikCommented:
Try it. And say what do you get?

<%
Response.Write Request.Cookies ("transp")
Response.Cookies ("transp").Expires = -1
%>
0
 
eladrAuthor Commented:
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.
0
 
Yury_DelendikCommented:
Sorry
<%
Response.Write Request.Cookies ("transp")
Response.Cookies ("transp").Expires = Now()
%>
and try your code
0
 
cybottoCommented:
I have the same problem with this cookies, there are working fine till something happens (maybe the limit of 30 cookies per Domain?). I realized in Netscape there is no problem to read cookies.  I'm sure i didn't make a mistake. Yes has something to do with the name or so, renaming helps.  I realized as well is only on my mashine where I developed my scripts, on other machines works fine.


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now