Jump to content

sessions VS cookies


hassank1

Recommended Posts

Sessions: stored on the server

Cookies: stored on the client's machine.

 

If you would like people to remain logged in whever they come to your website, use cookies. Otherwise use sessions.

 

Sessions usually set a cookie however, to track the session ID. This can be parsed around in the URL though. As was mentioned, it's probably best you do some reading.

Link to comment
Share on other sites

Indeed. The main security issue with sessions occurs when you allow the session ID to be passed around in the URL. What happens is that people may give someone else a link, not realising their session ID is in that link. The person that recieves the link then becomes logged in.

 

Hence why this option is generally disabled.

Link to comment
Share on other sites

In short, both. This is the most secure way, in my opinion. Use sessions, but store the session ID in the cookie.

 

Session propagation through URL, as described above, has security risks. Storing session data in a cookie has its equally dangerous implications, if someone is able to steal the cookie.

 

So store the session data on the server however you choose, and keep track of session ID's to correspond to the data in their cookies.

 

Bryan

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.