difference between cookies and session variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RamyaSrinath
    New Member
    • Mar 2008
    • 7

    difference between cookies and session variables

    please tell me the differences between cookies and session variables. i am very confused with that.
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi RamyaSrinath,

    Basically the difference is that any data stored in a session variable is destroyed when the session ends (i.e. when the user logs off or closes the browser) but any data stored in a cookie will survive.

    This is because cookies are stored on your local machine so the browser can access them each time you log in to a site with out having to prompt for the information again. This makes life easier for your user in most cases but the downside is that cookies can be blocked by some security settings.

    A session variable is not stored on your local machine so as soon as your session is ended the variable is destroyed.

    I hope this makes sense,

    Dr B
    Last edited by DrBunchman; Mar 17 '08, 11:40 AM. Reason: Typo!

    Comment

    • RamyaSrinath
      New Member
      • Mar 2008
      • 7

      #3
      Originally posted by DrBunchman
      Hi RamyaSrinath,

      Basically the difference is that any data stored in a session variable is destroyed when the session ends (i.e. when the user logs off or closes the browser) but any data stored in a cookie will survive.

      This is because cookies are stored on your local machine so the browser can access them each time you log in to a site with out having to prompt for the information again. This makes life easier for your user in most cases but the downside is that cookies can be blocked by some security settings.

      A session variable is not stored on your local machine so as soon as your session is ended the variable is destroyed.

      I hope this makes sense,

      Dr B
      hi. thank u for ur help

      Comment

      Working...