The examples in this article describe the use of cookies in asp.net. Share to everyone for your reference. The specific analysis is as follows:
Cookies are also used in the same ways as the ASP. For example, we set up a cookie named ASPCN, a flying knife.
HttpCookie cookie = new httpcookie["ASPCN"];
Cookie. Value = "flying Knife";
Response.appendcookie (cookie);
It's also easy for us to remove the cookie value.
HttpCookie cookie = request.cookies["ASPCN"];
Cookievalue = cookie. Value;
Sometimes we want to store multiple messages in a cookie, and that's fine. For example, we add more information under a cookie named ASPCN.
HttpCookie cookie = new HttpCookie ("ASPCN");
Cookie. Values.add ("webmaster", "flying Knife");
Cookie. Values.add ("writer", "Beige");
Cookie. Values.add ("LinkColor", "Blue");
Response.appendcookie (cookie);
Removing information is as simple as
HttpCookie cookie = request.cookies["ASPCN"];
value1 = cookie. values["webmaster"];
value2 = cookie. values["Writer"];
I hope this article will help you with the ASP.net program design.