Relationship between cookie and Session (2)

Source: Internet
Author: User
Relationship between cookie and session

1. session in Asp.net can adopt cookie and cookieless methods. cookieless places sessionid in the URL and transmits it back and forth between the client and the server without Cookie. This method is not discussed here.

2. In Asp.net, when the customer requests a URL for the first time, the server generates a sessionid for the customer and sends it to the client using a non-permanent cookie.

3. Non-permanent cookies disappear only when the browser is closed. The session timeout is determined as follows:

3.1 When the client accesses the server for the first time, it will get a sessionid and send it to the client as a non-permanent cookie.

3.2 When you access this URL before closing the browser, the browser will send this sessionid to the server, the server maintains various statuses of the server corresponding to this customer based on the sessionid (that is, various values saved in the session ).ProgramYou can perform operations on these sessions.

3.3 The server maintains the expiration time of this sessionid. You can set the Session Timeout time in IIS. Each request causes the server to extend the expiration time of this sessioid by a set timeout time.

3.4 when the server finds that a sessionid is out of date, that is, a customer has not accessed the site again within the specified timeout period, and deletes the sessionid along with all session variables related to the sessionid.

3.5 before the browser of the client is closed, the server does not know that the sessionid has been deleted. The client still sends the cookie of this sessionid to the server, but the server does not know the sessionid at this time, the user is treated as a new user and a new sessionid is assigned again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.