Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: What is Difference between Session and Cookie

by j3 (Friar)
on Mar 28, 2007 at 14:48 UTC ( #607035=note: print w/ replies, xml ) Need Help??


in reply to What is Difference between Session and Cookie

Remember, HTTP is a stateless protocol. Without adding any extra magic, if a user visits your site twice in a row, as far as the web server is concerned, those are two totally separate visits having nothing in common with eachother (save for coming from the same IP address).

If you want your web server to be able to remember users between pages they visit, you need some way to create a "session" -- some way to save information about the user so you can recognize them the next time they request a page.

The most common way to do this is by using cookies.

So, sessions are what you want, and cookies are most often how you get them.


Comment on Re: What is Difference between Session and Cookie
Re^2: What is Difference between Session and Cookie
by ikegami (Pope) on Mar 28, 2007 at 15:12 UTC

    save for coming from the same IP address

    Sometimes, not even that. Some people use load-balanced proxies, so requests don't always come from the same IP address. I believe AOL does this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://607035]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-10-02 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (46 votes), past polls