Solved

Long COOKIE Question

Posted on 1998-02-19
1
149 Views
Last Modified: 2013-12-25
I'm investigating the use of cookies.  There seem to be two ways in which one can set a cookie.

(1) In the HTTP header (prior to the rest of the HTML doc being sent) using: Set-Cookie: NAME=VALUE; expires=DATE;path=PATH; domain=DOMAIN_NAME; secure

(2) In the header of the HTML Document using:
<meta http-equiv="Set-Cookie" content="NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME">

Both presumably amount to the same thing.
Q1.  Is this correct.  Are both these methods supported by all browsers which support cookie funcionality?

Q2. Does the Set-Cookie header have to be part of a CGI generated HTML page or can it just appear in any HTML page (this really only seems to apply to Set-Cookie format 2 above).

Q3. At what point is cookie actually set. Presumably as soon as the browser receives the header/http-equiv tag?

Q4.  Can the information in the cookie be updated?  I'm having problems with this.  Eg. lets say I want a counter (I don't, but lets say I do).  MY_CNT=0001.  I want to update this each time using the Set-Cookie: MY_CNT=0002 (etc).  Will this actually work? I can't seem to get it to.

Q5. Do you have any good URL on how to use cookies - I've got some basic pages but need more details and more step wise examples.

Thanks
0
Comment
Question by:martinbw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
jcea earned 200 total points
ID: 1832025
Q1.

Me correct method is (1). In fact, cookie support is voluntary. Old browsers (very old) don't support them. New browsers can disable support.

Q2.

If a browser accepts format (2) (most, if not all, do), cookie can be set in any HTML document.

Q3.

That's browser specific and can derive in race conditions. For example, main HTML document sets a cookie used in an inline graphic.

Q4.

Yes, simply update values. The machine which updates the cookie must have read access, that is, must match domain.

Using words from Netscape:
"Instances of the same path and name will overwrite each other,
with the latest instance taking precedence. Instances
of the same path but different names will add additional
mappings."

Q5.

Try Netscape site:
http://home.netscape.com/newsref/std/cookie_spec.html

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question