cookie读、写、删除 创建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); }
cookie读、写、删除
最新推荐文章于 2021-03-09 14:24:23 发布