创建cookie
var cookie = new HttpCookie("member");
cookie.Values.Add("memberName", name);
cookie.Values.Add("memberType", type.ToString());
cookie.Expires = DateTime.Now.AddDays(30);
Response.Cookies.Add(cookie);
读Cookie
var cookie = Request.Cookies["member"];
if (cookie != null)
{
string name = cookie.Values["memberName"];
string type=cookie.Values["memberType"];
}
删除cookie
var cookie = Request.Cookies["member"];
if (cookie != null)
{
cookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(cookie);
}
{?