The principle of HTTP State retention

Source: Internet
Author: User


A) When the user logs in, the browser adds a cookie to the response when it returns
b) The browser will automatically save after receiving the cookie
c) When the user requests another page from the same server again, the browser will automatically bring the previously saved cookie
d) After the service receives the request, it can ask the requesting object to take a cookie to determine whether the current user is logged in

HTTP is stateless, is connected data interoperability, closed is permanent amnesia, why is it stateless? Because the browser and the server use the socket communication Ah, once the browser is closed, after four waves to destroy all the interactive information (talk about the TCP three-time handshake, Four waves) So what's the way to keep a state between the browser and the server, the cookie and the session difference: The cookie is stored in the browser, and each visit to the website will send the local saved cookie value (user's personal information) to the corresponding website, unsafe, The cookies under each domain name exist independently and do not interfere with each other. Seesion relies on cookies, but it is stored on the server and is more secure than cookies.

The principle of HTTP State retention

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.