In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what are the advantages and disadvantages of cookie and session". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the advantages and disadvantages of cookie and session".
1. Why use session control technology?
Web is implemented through the HTTP protocol, while the HTTP protocol is stateless, so when the same user requests the same page twice, the HTTP protocol will not think that the two requests come from the same user, but will treat them as independent of the two requests (that is, they will separate the two requests), and will think of them as two different user requests. If a user performs a login operation and requests the page again, the HTTP protocol will not assume that the user has logged in before, because it cannot maintain the user's previous login status, so it cannot track and maintain the user's status between different pages.
2. Working principle of Cookie
How cookie works: it is a technology in which fragments of information sent by the server to the client are stored in the memory or hard disk of the client browser. Think of it as a file stored in the browser, which contains some pieces of information about our client (such as login or some other information stored, etc.). This file is stored on the client! ]
3. Advantages and disadvantages of Cookie
The advantage of cookie: because cookie stores information on the client, it will not take up the resources of the server (that is, it will not waste the resources of the server) and will be more efficient. The disadvantage of cookie: it is also because it is stored in the client, because all our information is stored in the client computer, so it is not recommended to save some sensitive and important data in cookie, and users have the right to prohibit the use of cookie. If we disable cookie in the browser, once the user forbids cookie, we have no way to save the user's information.
4. The working principle of session
Store the same data of the user in the server
5. Advantages and disadvantages of Session
The advantage of session: the information is very secure, it is stored on the server side, and it is impossible for the client to get the session data. Disadvantages of session: it will take up the resources of the server (more and more session files may fill the disk one day), and its distribution is also a problem (for example: we may have multiple web servers in the future, but session may be stored in one of them, and the other one cannot be used. In this case, we can use redis, no matter which server we are on, we can call redis's server to achieve information sharing.
Thank you for your reading, the above is the content of "what are the advantages and disadvantages of cookie and session". After the study of this article, I believe you have a deeper understanding of what are the advantages and disadvantages of cookie and session. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.