当前位置:网站首页>The differences and advantages and disadvantages between cookies, seeion and token
The differences and advantages and disadvantages between cookies, seeion and token
2022-07-06 07:07:00 【smarthome_ man】
1、cookie( A computer file of information sent by a network or Internet user to a central server )
First of all, what is cookie Well ? seeing the name of a thing one thinks of its function cookie The first is a file , It is mainly a data generated by the browser that can be permanently stored in the browser . For example, our account number and password , Will be stored in cookie in , The next time you ask , Will directly enter the account password , It's more convenient , But the disadvantages also follow ,cookie It's easy to be hijacked by hackers , therefore cookie The security of is lower , So later, the browser added some restrictions to ensure cookie Will not be used maliciously , But the security is not very high .
2、session( In network applications, it is also called session control )
What is? session? Literally session It's conversation , Talk to someone one by one , It's your conversation with him , How do you know that it is Zhang San rather than Li Si who is talking to you , The other party must have some characteristics to show that he is Zhang San , For example, height , Age , Looks, etc .
session It also has similar meaning , The server should know that it is currently talking to itself ( Send a request to yourself ) Who is it . In order to distinguish between , The server will assign different tags to each client , Then when the client sends a request to the server , Will wear this mark to determine the identity of this person , The server will know who it is talking to , So how does the client save this tag , There are many ways , But for browsers , Are all adopted by default cookie Methods .
Server usage session Save the user's information on the server temporarily , But after the user leaves the website session Will destroy , however cookie It won't be destroyed , This storage method is relative to cookie For more security , Each has its own advantages .
3、token( token )
What is? token,Token Is a string generated by the server , As a token for the client to make a request , After the first login , The server generates a Token This is what we call it Token Return to the client , In the future, the client only needs to bring this Token Just come and ask for data , No need to bring user name and password again .
cookie And session The difference between
1、cookie Data is stored on the client ,session Data on the server .
2、cookie Not very safe , Should be used in consideration of safety session.
3、session It will be saved on the server for a certain period of time . When visits increase , We will compare the performance of your server to reduce the performance of your server , Should be used cookie.
边栏推荐
- 简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
- Huawei equipment configuration ospf-bgp linkage
- 19. Actual memory management of segment page combination
- NFT on fingertips | evaluate ambire on G2, and have the opportunity to obtain limited edition collections
- After working for 10 years, I changed to a programmer. Now I'm 35 + years old and I'm not anxious
- JDBC学习笔记
- Cookie技术&Session技术&ServletContext对象
- Leetcode59. spiral matrix II (medium)
- First knowledge of OpenGL es learning (1)
- LeetCode Algorithm 2181. 合并零之间的节点
猜你喜欢

首发织梦百度推送插件全自动收录优化seo收录模块

Short video, more and more boring?

呆错图床系统源码图片CDN加速与破解防盗链功能

First knowledge of OpenGL es learning (1)

Uncaught typeerror: cannot red properties of undefined (reading 'beforeeach') solution

Leetcode 78: subset

win10 64位装三菱PLC软件出现oleaut32.dll拒绝访问

Simple use of MySQL database: add, delete, modify and query

Cookie技术&Session技术&ServletContext对象

Leetcode35. search the insertion position (simple, find the insertion position, different writing methods)
随机推荐
开源的网易云音乐API项目都是怎么实现的?
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models.common‘ from ‘/home/yolov5/models/comm
After working for 10 years, I changed to a programmer. Now I'm 35 + years old and I'm not anxious
leetcode841. 钥匙和房间(中等)
#systemverilog# 可综合模型的结构总结
Embed UE4 program into QT interface display
Windows Server 2016 standard installing Oracle
Visitor tweets about how you can layout the metauniverse
Leetcode59. spiral matrix II (medium)
Arduino tutorial - Simon games
Pymongo gets a list of data
作者已死?AI正用艺术征服人类
The best way to learn SEO: search engine
将ue4程序嵌入qt界面显示
《从0到1:CTFer成长之路》书籍配套题目(周更)
When my colleague went to the bathroom, I helped my product sister easily complete the BI data product and got a milk tea reward
Development of entity developer database application
Upgraded wechat tool applet source code for mobile phone detection - supports a variety of main traffic modes
leetcode841. Keys and rooms (medium)
win10 64位装三菱PLC软件出现oleaut32.dll拒绝访问