http://www.perlmonks.org?node_id=607035


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

Replies are listed 'Best First'.
Re^2: What is Difference between Session and Cookie
by ikegami (Patriarch) 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.