The difference between a cookie and a session

Source: Internet
Author: User

The difference between a cookie and a session:

1. The cookie data is stored on the client's browser and the session data is placed on the server.


2, Cookies are not very secure, others can analyze cookies stored locally and make cookie spoofing
     consider security should use the session.


3. Session will be saved on the server for a certain period of time. When access is increased, it will be more likely to occupy your server's performance
The cookie should be used in consideration of mitigating server performance.


4, a single cookie can not save more than 4K of data, many browsers restrict a site to save up to 20 cookies.


5, so personal advice:
Storing important information such as login information as session
Additional information can be placed in a cookie if it needs to be retained

This article is from the "Brick Blog" blog, please be sure to keep this source http://wsxxsl.blog.51cto.com/9085838/1872379

The difference between a cookie and a session

Related Article

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.