1.

What are Cookies?

Answer»

It’s a tiny file that is being created by the client's browser and also get stored on the hard disk of that client. It doesn't utilize server memory. For the most part, a cookie is utilized to identify users.

A cookie stores client data. At whatever POINT a client makes a REQUEST for a page the first run through, the server creates a cookie and sends it to the client alongside the mentioned page and the client browser GETS that cookie and stores it on the client’s either permanently or temporarily. Whenever the client makes a request for a similar SITE, either the equivalent or another page, the browser checks the presence of the cookie for that site in the folder. In the event that the cookie exists, it sends that request with the same cookie, else that request is treated as a new request. Let see a sample code to understand how it works:

int postbacks = 0;  if (Request.Cookies["number"] != null)  {  postbacks = Convert.ToInt32(Request.Cookies["number"].Value) + 1;  }  // Generating Response  else   {  postbacks = 1;  }  Response.Cookies["number"].Value = postbacks.ToString(); Result.Text = Response.Cookies["number"].Value;


Discussion

No Comment Found