How to create cookie in ASP.NET

A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is used for an origin website to send state information to a user’s browser and for the browser to return the state information to the origin site. The state information can be used for authentication, identification of a user session, user’s preferences, shopping cart contents, or anything else that can be accomplished through storing text data.

You can add cookies to the Cookies collection:

HttpCookie myCookie = new HttpCookie(“visit”);
myCookie.Value = DateTime.Now.ToString();
myCookie.Expires = DateTime.Now.AddDays(1);