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 ........

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

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.