Difference Between Cookies and Sessions
Cookie- 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
- Due to cookies network traffic will increase.Size of cookie is limited to 40 and number of cookies to be used is restricted to 20.
- Only in few situations we can use cookies because of no security
- We can disable cookies
- Since the value is string there is no security
- We have persistent and non-persistent cookies
Session
- Session can store any type of data because the value is of datatype of "object"
- These are stored at Server side
- Session are secure because it is stored in binary format/encrypted form and it gets decrypted at server
- Session is independent for every client i.e individual for every client
- There is no limitation on size or number of sessions to be used in an application
- For all conditions/situations we can use sessions
- we cannot disable the sessions.Sessions can be used without cookies also(by disabling cookies)
- The disadvantage of session is that it is a burden/overhead on server
- Sessions are called as Non-Persistent cookies because its life time can be set manually
No comments:
Post a Comment