Differentiate between cookies and sessions.

Mumbai University > Information Technology > Sem 4 > Web Programming

Marks: 5M

Year: May 2015

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