Dave
Thu Jul 26 13:10:40 CDT 2007
"Jon Paal [MSMD]" wrote:
>>> So why not put all the session values in the cookie keys and
>>> skip the database ?
>>
>> That's like asking why people use session variables at all.
>
> um, because the question was based upon sharing sessions.
It might have extended the topic, but it still deserves to be examined as a
self-standing question.
Consider session variables in the simplest form. The server assigns
resources to the session and identifies it with a session ID, which is sent
to the browser for use in subsequent requests. The mechanism can be 1)
URL[1], 2) querystring, or 3) cookies. In the case of ASP, it is a cookie.
Does the server send all of the session variables in Response.Cookies? No.
It sends a key to the session, not the contents of the session. The reasons
are myriad, but they include security, privacy, data integrity, practicality
and browser limits on cookie length/number. A session-sharing schema would
necessarily share these concerns, so "putting all of the session values" in
cookies would be just as bad an idea in the shared-session model as in the
single-session one.
Hence, my response. Why do people use session variables at all? The answers
to that question also answer your "why not" question.
[1] Compare these three. Each goes to the same content. The second contains
the session ID, and matches the "session-id" cookie sent when the session
was created:
http://www.amazon.com/dp/0470124482/
http://www.amazon.com/dp/0470124482/105-4157465-0881918/
http://www.amazon.com/Professional-ASP-NET-2-0-Design-Themes/dp/0470124482/
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.