Answer to Question #96899 in HTML/JavaScript Web Application for Lorraine Motlokoa

Question #96899
What is the difference between cookies and session? In what circumstance should someone use
cookies or session? Support your answer with practical Examples.
1
Expert's answer
2019-10-21T07:18:29-0400

Cookies are data that the server can leave at the client (browser). Clearly: 

A client arrives, asks the server for a page.


The server in the response headers can set cookies. For example, issuing two headers: Set-Cookie: foo = 123 and Set-Cookie: bar = baz - i.e. - "remember, foo - 123, and bar - baz".


At the next call the client, if he decided to remember, tells the server "Cookie: bar = baz; foo = 123. "



A session is something that allows you to distinguish one user from another, and usually stores this data somewhere. For example, remember an authorized user.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS