Tutorials » AspNet tutorials »

What is Cookies in the web world


This chapter gives an introduction to Cookies used in internet world.


What is a cookie ?



Cookies are small files stored on the client computer.

What can be stored in a cookie ?



Web sites can store small pieces of information as key-value pairs in the cookie files. Any information can be stored in cookie as key-value pairs. However, there is alimitation on the total size of data that can be sent as cookie.

Also, it is not safe to store sensitive information in cookie. Since cookies are stored as text files in client computers, a smart user can edit and change the values in the cookie files.

Most of the web sites store information like your login name, last visit date etc so that when you visit the website next time, they can surprise you with messages like "Welcome back, Mr. John !"

Also, you may have noticed that when you login to many websites, there is an option called "Remember my User Id". Those sites will store your user id into the cookies. When you visit the web site next time, they will retrieve the login id from the cookie. Based on the login id, they can retrieve all information about you from the database and automatically login you to the website. Note that they will not store all details about you. Only login id is stored in the cookie. And most often the login id will be stored as encrypted so that nobody can alter it to some other user's login id.

Who creates cookies ?



Cookies are created in your computer, by your browser, if the website send any cookie information as part of the page you visit.

Browser seetings allow you to disable cookies. If you disable cookies, it will not store any cookies in your computer, even if the web site send any cookie to your computer.

But note that, several websites assume you have cookies enabled and such websites may not work as expected any more, if you disable cookies.

Where is it saved in your computer ?



In windows machines, cookies are stored in the Cookies directory in your user directory within within the Documents And Settings directory. This directory contains text files with this filename format:

your login name @ web site name.txt


A cookie from AspSpider.com can be like this:

john@aspspider.txt


These are the cookie files stored in your computer by various web sites. In addition to the cookie files, there will be one file called "index.dat". This is a file used by Internet Explorer to track all the cookie files.

You may delete all the cookie files from the "Cookies" folder. But you may need to re login to all the websites where you have specified 'Remember my login', because those web sites can't find your user information any more from the Cookies.

There is another way to delete all the Cookies. Open Internet Explorer and select the menu "Tools > Internet Options". Press the button "Delete Cookies". This will delete all cookie files from your computer.



Next Chapter: Working with Cookies in ASP.NET
Previous Chapter: Application object in ASP.NET
More Chapters: ASP.NET Tutorials
More Tutorials: Tutorial Index



Top Contributors
TodayLast 7 Daysmore...

Awards & Gifts

Online Members

AP
More...
 
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India