Cookies are stored on client side where as Sessions are server variables. We can store only a string value in a cookie where as objects can be stored in session variables.
We should go for Cookies to store something that we want to know when the user returns to the web page in future (eg. remember me on this computer check box on login pages uses cookies to remember the user when he returns). Sessions should be used to remember something for that particular browser session (like the user name, to display on every page or where ever needed).
No comments:
Post a Comment