View Full Version : response.cookies("Contact")("ContactID") = ContactID
06-23-2004, 12:56 PM
All I can find is massive functions or millions of lines of code, and to be honest I haven?t a clue what they accomplish. Surely there is one line of code that can achieve the same as a line of ASP code would.
Any help would be great as I am really stuck on this one. :confused:
06-23-2004, 01:02 PM
Did you try: document.cookie = ContactID; ?
Note: without and expiry date the cookie will be session only and will expire when the browser is closed. If you will need to set an expiration date you will need a few more lines of code however, not quite a million. ;)
If you need more help, you can try searching this forum. Cookie question have been asked and answered many times and there should also be several articles in the sticky FAQ at the top of this forum.
06-23-2004, 01:07 PM
But I need to set the ContactID within a cookie called Contact, I have searched the forums and that has not helped. The cookie needs to expire when the browser closes.
06-23-2004, 01:24 PM
06-23-2004, 01:26 PM
But surely that will set Contact to the value if contact ID?
06-23-2004, 01:37 PM
That's what I thought you wanted.
I guess you'll have to wait until someone else comes along because quite frankly from what you have provided, I don't even know if ContactID is a variable, string or an input value....
06-23-2004, 03:10 PM
I want a cookie called contact to have multiple values, one of these values is contactID so COntact.ContactID = 12 for example and Contact.ContactName = 'Willy'
06-23-2004, 03:25 PM
Then either use an array or use a seperator within the string such as a semi-colon or pipe so that you can easily split it out to use later.
A quick search of this forums search feature using the keywords using cookies provided 407 threads and the second being cookie with multible values (http://www.codingforums.com/showthread.php?t=40530&highlight=cookies) which would seem to answer your question.
Read and follow the links......
06-23-2004, 03:29 PM
I have looked at that already as I searched for cookies on the forum. I have followed the link to find the millions of lines of code I was talking about.
06-23-2004, 04:09 PM
var id = 12;
var name = 'Willy';
var Contact = 'Contact.ContactID='+id+
document.cookie = Contact;
06-23-2004, 04:24 PM
Spliting it up is a good idea, but I need to be able to read it as a normal cookir through asp. I cannot change the other pages.
06-24-2004, 04:58 AM
Try putting the key/value pairs (separated by &) in one cookie.
var ContactID = "123";
var ContactName = "blah";
var cookieValue = "ContactID=" + ContactID + "&ContactName=" + ContactName;
document.cookie="Contact=" + escape(cookieValue);
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.