Cookies FAQ's

Q: What is Cookie?

Ans:     

  • Cookie is small packet of information maintained by website at client system
  • Memory allocation for Cookie will be done at client system
  • All cookies of website are transmitted between client and server along with request and  response in the form  of cookies collection

Q: What type of data can be stored in Cookie?

Ans: Only simple plain text can be maintained in Cookie.

Q: How many cookies are allowed for website at client system?

Ans: 

  • According to w3c at the maximum 20 cookies allowed, but it totally dependens on browser.
  • Most of the browsers supports 5 to 8 cookies only.

Q: How the cookies are transmitted between client and server? 

Ans: In the form of cookies collection along with request and response.

Q: Where can we use cookies in website?

Ans: We can make use of cookies in any web page in website.

Q: What the maximum amount of data that can be stored with the help of cookies?

Ans:

  • Maximum size will be upto 4kb only.
  • All cookies of a website will be maintained in separate cookie file and its max size will be 4kb.

Q: What is Cookie Dictionary?

Ans: A cookie dictionary is a single cookie object that stores multiple pieces of information. You use the Values property to access and assign new values to the cookie dictionary.

Q: Maximum number of permanent cookies allowed in client system?

Ans: At the maximum 300 cookies are allowed in client system

Q: How to create a Cookie in asp.net website?

Ans:

  • By using HttpCookie class object
  • After creating cookie it will be attached to Response Object  to send it to client

Example:

HttpCookie httpCookie = new HttpCookie("Username","vikram");
Response.Cookies.Add(httpCookie); 

Q: What are the disadvantages of cookies?

Ans:

  • Cookies are maintained at client system, so that they are not secure.
  • Limited number of cookies are allowed for website(Max: 20).
  • Limited amount of data can be maintained(Max: 4kb).
  • Only plain text can be maintained.

Q: Where can you find the usage of cookies in your development?

Ans:

  • To maintain authentication details we can  make use of  authentication cookie.
  • To transmit session id between client and server.

Q: What the default authentication cookie name?

Ans: ASPXAUTH 

Q: What is the Cookie name used for transmitting sessionid between client and server? 

Ans: asp.net_sessionId

Q: How to disable cookies in client browser?

Ans: We can make use of browser options, it depends on browser.

Q: Where the memory for temporary cookie is allocated?

Ans: As part of browser process memory, so it is also called In-memory cookie (or) In-process cookie.

Q: What are different types of cookies?

Ans: There are two types of cookies

  1. Temporary cookie
  2. Permanent cookie