I know there are several articles on cookies as what are they? and how can they be created? but i always wanted to know more about them. My questions were where they are stored? how to track their expiry? If they contain user centric information then Can they be encrypted?

Lets explore each of my question then we will go more into coding part of cookies. I remember the first definition of cookie that i learned

“Cookie is a text file which is stored at the user’s hard disk and contains user’s session information”

This definition is very much synonymous to Google definition:

“A small sweet cake, typically round, flat, and crisp.”

Good.Right? Our Cookie is a small file like small cake and provided sweet feeling by streamlining our session information.

But when i really started working on cookies, I had my share of queries and resolutions like I came to know that as ‘http’ is a stateless protocol so we always have to attach our session information.

What is this session information and why it is required every time?

Well, the best answer is user expectations, we always want our web to be extra smart.Don’t we?

if i say, you don’t have to sign in to your Gmail account on each request or you don’t have to add the items on your shopping basket every time or you just want your website to tell you,when you visited the site last time.

This is the smart decisions we expect from our website but as HTTP protocol is stateless and can’t retain our information then what it did, it provided a Cookie mechanism to store the information at user’s side and send it to server on each request where it gets modified as per the request and sent back to the user to store it again.

Here, I’ll sweetify the definition a bit:

“Cookie is a piece of client’s information kept at client’s side in the form of a text file and , on each request and response, this information travels between the server and client”

No files travels between server and client, only information travels in between server and client. At client side, information is read by the ‘HTTP’ request from this text file and while the response is received, this file is written with the updated information again.

So where this file is located, It depends on the browser so let’s believe what we see now.

In FireFox

Run this:


To read the data you need to connect to that database and query the DB

In Internet Explorer

Run this :




In Chrome

Run this:

%AppData%\\Google\Chrome\User Data\Default\Cookies



Now, we have seen our cookies and found that they really exists. We have a lot of information to cover so we will try to find answers for more of our queries in next article of this series. Cookies Part 2

Author: hershey

A passion for knowledge drives me to do programming, A passion for programming drives me to create something different, A passion for creation drives me to spread the knowledge.

Share This Post On


  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread:

  • Asp.Net: More about CookiesAsp.Net: More about CookiesWe have seen, how our cookies looks in our last article Cookies Part 1. In this article, we will talk about their properties,limitations and technical part. Properties and Limitations Cook...
  • Useful ‘ref’ and ‘out’ parametersUseful ‘ref’ and ‘out’ parameters It took me some time to realize the real potential of ref and out keywords, till the time I experience a condition which could only be simplified by implementing ref and out keyword. Lets st...
  • Nullable .Net typesNullable .Net typesWe declare .net types in our project daily but still we do not recollect default values for each .net type so we end up doing null check for each data type. Its a basic mistake of a developer but ....
  • C#: My experience with const keywordC#: My experience with const keywordThere are numerous post on internet about 'what is const keyword in .net' or 'what is the difference between const keyword and read only' and I must say many might have already mugged it up like me...
  • C# Code to send a MailC# Code to send a MailWhile working in a project, we always neglect the importance of the code which we have written many times and now end up in copy pasting the code from old projects. Lately, I saw a request in fo...
  • Why Multiple Inheritance is discouraged?Why Multiple Inheritance is discouraged?Hi Guys, This is Sathish Again,Today we will discuss why most of the higher languages eliminates Multiple Inheritance? Most of you guys already know that multiple inheritance is not available for...
  • Concepts: S O L I DConcepts: S O L I DSOLID - Object oriented programming principles. May be its easy to forget these principles  but for creating a reusable code or maintainable code, people will always have to come back and check ...
  • VB.Net: Download file from FTP and UnZipVB.Net: Download file from FTP and UnZipExperience: Many application requires data migration tasks to execute on daily basis. To achieve this we generally seek help of SSIS package, if at all we are making use of SQL sever. ...