例子:
Cookie的写入:
1HttpCookie cookie=new HttpCookie("Simple");
2cookie.Values.Add("Simple1",HttpUtility.UrlEncode("大叔,你好!"));
3cookie.Values.Add("Simple2","English is OK!Nothing we should do!");
4Response.AppendCookie(cookie);
Cookie的读取:2cookie.Values.Add("Simple1",HttpUtility.UrlEncode("大叔,你好!"));
3cookie.Values.Add("Simple2","English is OK!Nothing we should do!");
4Response.AppendCookie(cookie);
1HttpCookie cookie=Request.Cookies["Simple"];
2string simple1=HttpUtility.UrlDecode(cookie["Simple1"]);
3string simple2=cookie["Simple2"];
这样simple1="大叔,你好!";simple2="English is OK!Nothing we should do!";2string simple1=HttpUtility.UrlDecode(cookie["Simple1"]);
3string simple2=cookie["Simple2"];
很简单吧!!!