What is the difference between storing a session variable and storing a cookie? In this article I will give you a quick insight between a Session and a Cookie.
Sessions are stored by the user in memory on the server. Sessions use a cookie “session key” to attach a user to the session. This means no sensitive data is stored in the cookie on the user machine.
Sessions are generally used to maintain state when you navigate through a website. However, they can also be used to hold commonly accessed objects.
Cookies are stored by the user on the user’s machine. A cookie is most use for small information. Cookies are usually used for simple user. No sensitive information be stored in a cookie.
A user can clear this cookies at any time or not allow cookies all together so you cannot trust on them being there just because a user has visited your site in the past.
This concludes Sessions Vs. Cookies