Monday, October 2, 2017

Session & Cookie


What is a "COOKIE"?


A cookie is a small piece of text stored on a user's computer by their browser.
               Each time the users' web browser interacts with a web server it will pass the cookie information to the web server. Only the cookies stored by the browser that relate to the domain in the requested URL will be sent to the server. This means that cookies that relate to www.example.com will not be sent to www.exampledomain.com.

It is stored limit amount of data,  only allowing 4kb[4096bytes].

It is not holding the multiple variable in cookies.

We can accessing the cookies values in easily. So it is less secure.

Cookie Basic:
  • The first time a browser connects with a particular server, there are no cookies.
  • When the server responds it includes a Set-Cookie : header that defines a cookie.
  • Each cookie is just a name-value pair.
  • In the future whenever the browser connects with the same server, it includes a Cookie: header containing the name and value, which the server can use to connect related requests.


What is a "SESSION"?


Cookies are used by the server to implement Sessions:
              A pool of data related to an active connection (one browser instance).

To store information that is not appropriate to store client-side, we use Sessions.

A session can be defined as a server-side storage of information that is desired to persist throughout the user's interaction with the web site or web application.
               Instead of storing large and constantly changing information via cookies in the user's browser, only a unique identifier is stored on the client side (called a "session id"). This session id is passed to the web server every time the browser makes an HTTP request (eg: a page link or AJAX request). The web application pairs this session id with it's internal database and retrieves the stored variables for use by the requested page.



Sessions are stored in server side.

It is stored unlimited amount of data.

It is holding the multiple variable in sessions.

We cannot accessing the cookies values in easily. It is more secure.

No comments:

Post a Comment

My First Day with Uki DN Cohort 1

 "Hello WORLD!"