public static void write(CookieIds id, string val, bool persist = false) { HttpContext.Current.Response.Cookies.Add(new HttpCookie(id.ToString(), val) { Domain = cookieDomain(HttpContext.Current), Path = "/", Expires = persist ? DateTime.UtcNow.AddMilliseconds(100000000) : DateTime.MinValue }); }
public static void remove(CookieIds id) { HttpContext.Current.Response.Cookies.Add(new HttpCookie(id.ToString(), "") { Domain = cookieDomain(HttpContext.Current), Path = "/", Expires = DateTime.UtcNow.AddYears(-1) }); }
public static string read(CookieIds id, string def = null) { HttpCookie cook = HttpContext.Current.Request.Cookies[id.ToString()]; return cook != null ? cook.Value : def; }