Tuesday, December 9, 2008

Difference between Session and Cookies

Difference between Session and Cookies
1. The main difference between cookies and sessions is that cookies are stored in the user's browser, and sessions are not.
2. But Sessions are popularly used, as the there is a chance of your cookies getting blocked if the user browser security setting is set high.
3. The Key difference would be cookies are stored in your hard disk whereas sessions aren’t stored in your hard disk. Sessions are basically like tokens, which are generated at authentication. A session is available as long as the browser is opened.
4. A session as is a server-side object which stores State. A cookie is a small piece of information a browser sends to a server with every request.
5. Session should work regardless of the settings on the client browser. even if users decide to forbid the cookie (through browser settings) session still works. there is no way to disable sessions from the client browse
6. Session and cookies differ in type and amount of information they are capable of storing.

No comments: