+ 5

In HTML

What is the difference between SESSION and COOKIES?

15th Jul 2018, 11:33 AM
Jesyl Andrea Alcanzo
Jesyl Andrea Alcanzo - avatar
8 Réponses
+ 8
All answers helpful , I would just add Session Vs cookie is a little confusing question coz cookies can also be used to create sessions ( but unsecure and on users browser) session in general means having a secure window of connection between a client and server, and it's basically a term used to denote a time window when sensitive data is passed between parties and you won't need to authorize every task with password. when we do Facebook logins we create a session too, ( when we click remember me then we say that don't end this session when I close this Facebook tab) So to achieve a secure session , we generally save those sensitive session data on server ( backend) but we can also store that same session data on users browser with cookies , ( it would be simpler but unsecure coz anyone can access cookies ) we can use Jwt saved in cookies to create stateless but secure sessions, ( localstorage is better than cookies for this task)
15th Jul 2018, 12:56 PM
Morpheus
Morpheus - avatar
+ 4
The main difference between a session and a cookie is that session data is stored on the server, whereas cookies store data in the visitor's browser. Data stored in cookie can be stored for months or years depending on the life span of thecookie.But the data in the session is lost when the web browser is closed
15th Jul 2018, 11:45 AM
estifanos
estifanos - avatar
+ 3
Session also uses cookies to store user identifier on visitor browsers, called session cookies. When visitor request authentication, it informs server with session cookies, before server could retrieve more user information from server session. Main difference is session does not store user information on clients , whereas cookies store all information on clients pc. Thus session is more secure than cookies.
15th Jul 2018, 11:54 AM
Calviղ
Calviղ - avatar
+ 3
you might also wanna Google on cookies Vs Sessionstorage Vs local storage, i assumed you meant session in general and not Sessionstorage in essence they all are just very simple ways of storing data on users machine.
15th Jul 2018, 1:06 PM
Morpheus
Morpheus - avatar
+ 1
i guess,when user closes browser,session gets terminate, and cookie can expire later,you can set time for cookie,
17th Jul 2018, 3:05 AM
Tarika
Tarika - avatar
0
Sessions allow you to store away individual pieces of information just like with cookies, but the data gets stored on the server instead of the client.
17th Jul 2018, 1:52 PM
Rafey Iqbal Rahman
Rafey Iqbal Rahman - avatar
0
cookies are insecure and session is secure
21st Jul 2018, 4:15 PM
Pragnesh Katkar
Pragnesh Katkar - avatar