Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is a difference between cookie and session


What I have tried:

What is a difference between cookie and session
Posted
Updated 13-Sep-19 8:23am

Here's two:

1) Basically, a Cookie is stored on the Client machine, while the Session is stored at the Server.

2) Cookies can persist past the user disconnecting from a website (and even powering down the client PC) but you get a new Session each time a client connects to the Server.
 
Share this answer
 
Both Cookies and Sessions are values or collections of values.

Cookies
1. Saved on the client computer as a text file; can be tampered with by the end-user
2. Expiration dates can vary, they can expire immediately or years from now

Session
1. Saved in memory on the server.
2. Expires at the end of the client session (or a short time afterwards, eg 15 minutes)
3. Depend upon Cookies; a Session ID cookie is used to match session to browser
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900