ㄟ要不要來coding
Cookie & Session
Try
HackMD
ㄟ要不要來coding
·
Follow
Last edited by
tim890922
on
Dec 22, 2022
Linked with GitHub
Contributed by
Edit
Comments
Feedback
Log in to edit or delete your comments and be notified of replies.
Sign up
Already have an account? Log in
There is no comment
Select some text and then click Comment, or simply add a comment to this page from below to start a discussion.
Discard
Send
Cookie & Session
Cookie
Cookie (小餅乾),只是個小文件,通常會記錄一些對網站的個人喜好設定。
有些sessionid也寫在裡面!
如果網站是用session驗證做帳號密碼傳遞交換,並且相依於cookie安全設定而產生的 session的id,被包在裡面。
因為Cookie傳送時是以明碼方式傳送,機密資料不建議以此方式儲存。
資料存放在客戶端,不會造成伺服器端的過載。
存在用戶端的cookie,不會因為瀏覽器的關閉,而消失。(直到時效失效為止。)
應用
用戶的購物車
登陸時的記住帳號密碼
Session
Session 主要儲存在Server端的位置,安全性高。
主要是記錄著,在 web server 上的使用者訊息(一個SessionID對應一筆SessionID)。
Session 在伺服器端並不會自動失效,除非session已經超過設置的失效時間。
Session 機制會在一個用戶完成身分認證後,存下所需的用戶資料,接著產生一組對應的對應的id,存入 cookie 後傳回用戶端。
應用
用戶登陸的訊息(因牽扯用戶資料不適合在Cookie)
來訪紀錄(網頁計數器)
tags:
小知識
,
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up
Comment