Diffrence between cookies and session variables
Hi,
I am a front end programmer in Company, I will work on web programmer that is based on java, I have confusion on session variables, Can anybody know that what is difference between cookies and the session variables, Please help me, It is very urgent.
Cookies identify the user
Cookies are stored on your local machine but the session variable is not stored on your local machine, so the browser can access them each time when you log in to a website with out having to prompt for the information again with the help of cookies. But for session variable, your session is ended the variable is destroyed. Session variables hold all information about one single user, and are available to all pages in one application but in cookies, is often used to identify a user.
Data stored in a session variable is destroyed
A cookie is a small file that the server embeds on the user computer. Each time when the user login on the same computer requests a page with a browser, it will send the cookie too. The downside of the cookies is that it can be blocked by some security settings. When the user logout, the data stored in a session variable is destroyed.
Disadvantages of cookies.
Basically Cookies is used in Client side but session variable used in server side. But the implementation of cookies is difficult. Also Size limitations and Potential security risks is cookies. Simple implementation, Process independent Support for server farm configurations and extensibility is the best future of session variable. Disadvantage of cookie is also that it will not work if the client user disable the cookie or don't accept cookie.
Tracking Data setting by cookies.
There is no option for disabling a session in the browser but in cookies you will disable the acceptance by browser setting. Data stored in session variable when the session ends. But in cookies, it store a small amount of data stored either in a text file on the client's file system. Cookies are mainly used for tracking data settings.
E bay shopping cart utilized cookies
A cookie is often used to identify a user but session variable is not stored on your local machine, so it can not identity the user . Session variables hold information about only one single user, and are available to all pages in one application but Cookies makes life easier for your user in most cases. Basically a cookie is a small file that the server embeds on the user's computer. Sessions works as a token allowing access and passing information while the user has their browser open. Cookies works as for example, your e bay shopping cart utilized cookies, and a person had their browser set to block them, then they could not shop at your website. User can also destroy the cookies.