Can a COOKIE be placed on the server? How can I identify a browser? No? Why?

Source: Internet
Author: User
Can a COOKIE be placed on the server? How can I identify a browser? No? Why? Can a COOKIE be placed on the server? How can I identify a browser? No? Why?

Reply content:

Can a COOKIE be placed on the server? How can I identify a browser? No? Why?

No.

Because the HTTP protocol is stateless, that is, the server does not know what the user did last time, which seriously hinders the implementation of interactive Web applications. In typical online shopping scenarios, users browsed several pages and bought a box of cookies and two drinks. During the final checkout, the server does not know what the user has bought because of the stateless HTTP. Therefore, cookies are one of the "Additional methods" used to circumvent the stateless nature of HTTP. The server can set or read information contained in Cookies to maintain the state of the user's session with the server.

In the shopping scenario just now, when the user buys the first item, the server also sends a Cookie while sending the webpage to the user, recording the item information. When a user accesses another page, the browser sends the Cookie to the server, so the server knows what he bought before. The user continues to purchase drinks, and the server adds new product information to the original Cookie. During the checkout, the server can read the sent Cookie.

By the way, the server has an HTTP Session.

Isn't cookie a string of small text that will be carried by the browser every time you request it? What is the concept of putting it on the server?

Yes. The client on the server cannot access it --#
What do you want to do ......

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.