Jump to content

Whats the difference between a session and a cookie?


11Tami

Recommended Posts

Session and cookie both are temporary saved the data in temporary files.

 

The main diff is session's temporary files are saved in server while cookie's temporary files are saved in client machine.

 

session will lost data when browser closed. while in case of cookie you can use persistent cookie so save data londger ........

........................

.......................

Its a bit like comparing apples to oranges. They are two different things. Sessions rely on cookies by default. When you start a session a cookie is stored on the client machine holding there session id. Any other data you place in a session is then stored in a temporary file on the server. Sessions last the lifetime of a clients visit and are genarally used to identify and login users.

 

Cookies are simply text files stored on the client machine. While they can also beused for identification, because they reside on the client they are not as secure as a session may be.

Sessions are 'cookies' but stored on the server. The values of sesion variables can only be changed by the server.

 

'Cookies' are client side cookies (a session normally stores a cookie as an ID of a session cookie otherwose the ID gets apssed in the url). These are files (or portion of files) stored on your onw machine with info in them that the site can use.

 

both sessions and cookies cna be hijacked - but only cookies can have their vlues altered by the malicious litle bugger messin around....

 

In short both are a buffer if you like of info that you may need to use a lot...

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.