Cookies Vs. Session Variables

Given Security, Speed, and Ease what is better to use on a website Cookies or Session Variables? I don't know much about cookies but Session Variables seems like an obvious choice, but i don't know how to back up the argument? Any info on both of these would be great, especailly if you explain why you choose what you did. Thanks!

Comments

  • : Given Security, Speed, and Ease what is better to use on a website Cookies or Session Variables? I don't know much about cookies but Session Variables seems like an obvious choice, but i don't know how to back up the argument? Any info on both of these would be great, especailly if you explain why you choose what you did. Thanks!
    :
    It depends on what you are "tracking" and how long you want to track it. I personally like session variables for most situations. Session variables are "randomly" generated by the application/language (ASP, PHP, etc.)and only last as long as the browser is open. That helps prevent inappropriate access by subsequent users of the same machine. If you have personalized settings that you want saved from one session to the next, then obviously, you need cookies, or something similar. By leaving out the expiration info in a cookie, you can accomplish kind of a pseudo-session variable that is only stored in the browser and not on the harddrive and goes away when the browser is closed.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion