Session
-
- Session can store any type of data because the value is of data type of “object”
-
- These are stored at server side.
-
- Sessions are secured because it is stored in binary format/encrypted form and gets decrypted at server.
-
- Session is independent for every client i.e. individual for every client.
-
- There is no limitation on the size or number of sessions to be used in an application.
-
- We cannot disable the sessions. Sessions can be used without cookies also.
-
- The disadvantage of session is that it is a burden or an overhead on server.
-
- Sessions are called as Non-Persistent cookies because its life time can be set manually
Cookies
-
- Cookies can store only “string” datatype.
-
- They are stored at client side.
-
- Cookie is non-secure since stored in text-format at client side.
-
- Cookies may or may not be individual for every client.
-
- Size of cookie is limited to 40 and number of cookies to be used is restricted to 20.
-
- Cookies can be disabled.
-
- Since the value is in string format there is no security.
-
- We have persistent and non-persistent cookies.