There is a lot of difference between cookie and session. Both are used to store client information. Websites use cookie and session to identify users.
For example, we visit a website, browse the contents of the website and search something on that website but next time when we visit that site again, they recognize us and show the previous contents and searches where we left before.
Cookie
Cookie are small files stored on client computer. The purpose of the cookie is to track a user when the user visit a site.
Every time when a user send request to the server, the browser sends cookie files along with the request and server uses those information to identify the user.
Session
Session is also used to store user information but unlike cookie, it store information on the server. Session is end when a user closes the browser or leave the site. Server terminates the session after a period of time which is about 30 minutes.
0 Comments