NOTE
2.13 Cookie and Session
Historical notes on the cookie/session mechanism and a simple comparison.
This is a historical learning note and may contain outdated or incomplete understanding.
1. How Cookie + Session Works
The browser accesses the server. The server creates a session representing the conversation, generates a session ID to identify it, sets the session ID in a cookie, and returns it to the browser. Every time the browser accesses the server, it carries the cookie containing the session ID. After obtaining the session ID, the server can determine which user is accessing it.
2. Cookie vs. Session
| Cookie | Session | |
|---|---|---|
| Location | Stored in the browser | Stored on the server |
| Format | Text file | Memory |
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub