save cookies and get cookies in system using asp.net
1. use Response.cookies[“cookiesname”][“keyname”] to save cookies
2. use Request.cookies[“cookiesname”][“keyname”] to get cookies;
Eg.
Save cookies codingl
Response.Cookies["userinfo"]["username"] = tb_username.Text;
Response.Cookies["userinfo"]["planner"] = tb_planner.Text;
Response.Cookies["userinfo"].Expires = System.DateTime.Today.AddDays(10);
Get cookies coding
assumption: there are two texbboxs username and planner. When user input the username, the planner will fill out the textbox automatically.
string oldstr = Request.Cookies["userinfo"]["username"];
if (tb_username.Text==oldstr)
tb_planner.Text = Request.Cookies["userinfo"]["planner"];