Professional Documents
Culture Documents
What Are Cookies? What Are The Differences Between Them (Session vs. Persistent) ?
What Are Cookies? What Are The Differences Between Them (Session vs. Persistent) ?
Contents
Introduction
Background Information
There are 2 different types of cookies: Session cookies and persistent cookies
Introduction
This document describes what HTTP cookies are and what the difference is between session cookies and
persistent cookies.
Background Information
Cookies are strings of data that a web server sends to the browser. When a browser requests an object from
the same domain in the future, the browser will send the same string of date back to the origin server.
The data is sent from the web server in the form of an HTTP header called "SetCookie". The browser sends
the cookie back to te server in an HTTP header called "Cookie".
The following is an example of what an HTTP cookie transaction may look like:
[...]
SetCookie: first.lastname
[...]
Cookie: first.lastname
In the above sample transaction, the web server told the client to create the cookie "first.lastname". The next
time the client requests an object from this domain it sends the cookie wihin the request. This illustrates how a
web server may be able to recall certain information such as user logins.
There are several different fields a cookie can contain, seperated by semicolons. Definitions are below:
expires:
path:
path=/
Determines what path to return the cookie on. In this example, the cookie will be sent when going to the root
path in a domain.
domain
domain=whatever.domain.com
Specifies what domain the cookie is used for. If this does not match the domain currently being browsed to, it
is considered to be a "3rd Party cookie" and will be rejected by the browser. This prevents one domain setting
a cookie for a different domain.