What are Cookies in ASP.NET?

Cookies are a State Management Technique that can store the values of control after a post-back. Cookies can store user-specific information on the client’s machine, such as when the user last visited your site. Cookies are also known by many names, such as HTTP Cookies, Browser Cookies, Web Cookies, Session Cookies and so on. Basically cookies are a small text file sent by the web server and saved by the Web Browser on the client’s machine.

List of properties containing the HttpCookies Class,

  1. Domain: Using these properties we can set the domain of the cookie.
  2. Expires: This property sets the Expiration time of the cookies.
  3. HasKeys: If the cookies have a subkey then it returns True.
  4. Name: Contains the name of the Key.
  5. Path: Contains the Virtual Path to be submitted with the Cookies.
  6. Secured: If the cookies are to be passed in a secure connection then it only returns True.
  7. Value: Contains the value of the cookies.
    Limitation of the Cookies
  • The size of cookies is limited to 4096 bytes.
  • A total of 20 cookies can be used in a single website.