ASP. NET Session implementation principle analysis, asp. netsession
Analysis of ASP. NET Session implementation principles
When a user submits a request to the server, the server assigns each user a SessionId, which is stored in Cookies of the user's browser. The SessionId is global, that is, as long as the Cookies still exist, the server considers this as the same user, so that each user has its own global Session domain. When the user sends the Cookie of this SessionID to the server in the http header, the server will find the SessionID if it finds it. This proves that the user's status exists.
We can clear sessions through the following experiments:
Click the button to return the page, but the output is still the same SessionId
The SessionId saved by the server on the client for this user in the Cookies of the browser, the server uses this SessionId as the key to search for the Session domain of this user in the Session of the server.