Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are session and cookies the same thing?

Tags:

asp.net

Since session and cookies are both used to store temporary data, what is the difference between them?

like image 214
Shalni Avatar asked Sep 24 '10 12:09

Shalni


People also ask

Is session and cookies the same?

Cookies are client-side files that are stored on a local computer and contain user information. Sessions are server-side files that store user information. Cookies expire after the user specified lifetime. The session ends when the user closes the browser or logs out of the program.

Are cookies part of session?

Session cookies are cookies that last for a session. A session starts when you launch a website or web app and ends when you leave the website or close your browser window. Session cookies contain information that is stored in a temporary memory location which is deleted after the session ends.

Should I use session or cookie?

Sessions use a cookie as a key of sorts, to associate with the data that is stored on the server side. It is preferred to use sessions because the actual values are hidden from the client, and you control when the data expires and becomes invalid.


1 Answers

Cookies store a user's data on their computer.

Session implementations store a user's temporary data on a server (or multiple servers, depending on the configuration).

like image 135
Jeff Sternal Avatar answered Dec 22 '22 03:12

Jeff Sternal