添加、修改、删除cookie

添加、修改、删除cookie. public class Cookie { /// ///创建Cookies /// /// Cookie主键 /// Cookie键值 /// Cookie天数 /// Cookie ck = new Cookie(); /// ck.setCookie("主键","键值","天数"); public bool setCookie(string strName, string strValue, int strDay) { try { HttpCookie = new HttpCookie(strName); Cookie.Expires = DateTime.Now.AddDays(strDay); Cookie.Value = strValue; System.Web.HttpContext.Current.Response.Cookies.Add(Cookie); return true; } catch { return false; } }
docx 文件大小:17.63KB