Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing Response.Cookies

Status
Not open for further replies.

ashaig

Programmer
Apr 9, 2001
26
GB
Hi,

I'm setting up a cookie at the beginning of a long-winded application (lots of data entry) and by the time I want to retrieve it (maybe 30 minutes later) to save to database its gone!
I've tried seting Expires property to 2 days in advance to no avail. Code is below - the Response.Cookies statement is at bottom. Any suggestions gratefully received.


<SCRIPT language=vbscript runat=server>

Function addDate(thedate)

addDate = DateAdd(&quot;d&quot;, 2, thedate)

End Function
</SCRIPT>
</head>
<body>

<%
var dt = new Date();
var mon = dt.getMonth() + 1;
var today = dt.getDate();
var tomorrow = dt.getDate();
if (today < &quot;10&quot;)
{
today = &quot;0&quot; + dt.getDate();
}
if (tomorrow < &quot;10&quot;)
{
tomorrow = &quot;0&quot; + tomorrow;
}
var yr = dt.getFullYear();
var sdate = today + &quot;/&quot; + mon + &quot;/&quot; + yr;
var sysdate = tomorrow + &quot;/&quot; + mon + &quot;/&quot; + yr;
sysdate = addDate(sysdate);

Response.Cookies(&quot;staffid&quot;) = loRS.fields.getValue(&quot;PERSON_ID&quot;);
Response.Cookies(&quot;staffid&quot;).Expires = sysdate;
%>

 
Ok, maybe too simple to be right but just do Response.Cookies(&quot;staffid&quot;).Expires = Date + 1

and forget about all this

var sysdate = tomorrow + &quot;/&quot; + mon + &quot;/&quot; + yr;
sysdate = addDate(sysdate);
etc Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top