Click to See Complete Forum and Search --> : Cookies/ASP/Javascript


BikerBri4u
10-30-2003, 12:08 PM
I have been researching this question for hours without an answer, any help would be so much appreciated.

I use a simple COOKIE writing routine in my ASP pages... like so.
Response.Cookies("cookie_test")("active") = "TRUE"
Response.Cookies("cookie_test").Expires = Date + 1

I have 2 SETS of cookies.. one for the CUSTOMER info and one for the cookie_test info. The CUSTOMER info set looks like this...

Response.Cookies("customer")("FirstName") = "Bob"
Response.Cookies("cookie_test").Expires = Date + 1

I then read this cookie_test from another ASP page. No problems here.

But I have some HTML pages that need to write the same cookie and I need to use Javascript to do this. But I can not find where Javascript will let me use separate SETS of cookies like ASP does. It just lets me write ONE SET of cookies with different values in each.

Any help on how I translate THIS into Javascript
Response.Cookies("cookie_test")("active") = "TRUE"
Response.Cookies("cookie_test").Expires = Date + 1

I have looked at many many Javascript sites and can't find this info anywhere.

Thanks in advance...

Khalid Ali
10-30-2003, 08:34 PM
If I understood you correctly,
You should be able to set multiple cookies from one page using different names

BikerBri4u
10-30-2003, 10:51 PM
Yes.. they are separate names... one is called cookie_test and the other is called FirstName. I have been thinking all along (which might be where I am going wrong) that these the Customer information must be in a subset like this.. using ASP:

Response.Cookies("customer")("FirstName") = "Bob"

when in reality.. I can do away with the subset "customer" altogeather. All I need is a simple list of cookies...

Response.Cookies("FirstName") = "Bob"
Response.Cookies("cookiet_test") = "TRUE"

which in Javascript would translate into:
var now = new Date();
now.setTime(now.getTime() + 1000 * 60 * 60 * 24)
document.cookie = "cookie_test=TRUE;expires=" + now;
document.cookie = "FirstName=Bob;expires=" + now;

does this sound reasonable?

Khalid Ali
10-31-2003, 07:35 AM
I am not well versed in ASP,you have a better chance in the ASP section to get a better answer.
for Javascript and cookies part,I am pretty sure using 2 separate names one can create 2 separate cookies from one page.

Let me know if you wnat this post to be moved over to ASP.