what is the difference between sessions and cookies

Manish Goyal

Manish Goyal

@manish-r2Hoep Oct 26, 2024
Both sessions and cookies are used to store user information

but what is the exact difference between sessions and cookies?

when to use cookies and when to use sessions?

@Big_k sir it would be great if you can explain me taking example of CE?

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • durga ch

    durga ch

    @durga-TpX3gO Aug 2, 2010

    let BIg k explain you in what ever formats you want ,but in general - cookie are small samples of your browsing information and session is generally a specific ongoing interaction between the user and the internet.Cookies are in turn used to maintain a continuous session. For example - you log into a bank web page and navigate across the pages of say share market your accounts et al. each time you send a request to the server asking for a specific page , does that mean the server will end up asking you to authenticate your self each time? cookies are used kinda used here to maintain the sessions between the user and the bank server till the user clicks 'logout'
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Aug 2, 2010

    Thanks Durga for your reply

    Can we maintain a continuous session using sessions alone?

    what can be the maximum life of a cookie?
  • durga ch

    durga ch

    @durga-TpX3gO Aug 3, 2010

    are you talking only in context of application layer ?
    sessions can be established without cookies ( i would need someone to support me here). For example - when I log into a switch or a dslam or for that matter do a simple tlnet to a distant machine , i generally establish a session with the remote server. my session will expire on some time or when i logout and close the session.
  • Pensu

    Pensu

    @pensu-8tNeGU Aug 3, 2010

    In a simple way cookies are stored in your browser and session is maintained in server. You have full access on cookies i.e. u can delete them but you can't erase the session until unless you have access to server.


    Correct me if i am wrong.
  • computeridiot007

    computeridiot007

    @computeridiot007-xUubel Aug 3, 2010

    in simple way,
    sessions will be processed on the server side
    whereas cookies will be processed on the client side.
    hope it will be clear
  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Aug 4, 2010

    Thanks Guys for your replies but one of the important difference, i found today is sessions data cannot be moved from one web server to another ie if situations comes when there is a need to redirect a visitor of a website to another web server,there sessions will fail ,at that time cookies serve the purpose