Example #1
0
 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
   });
 }
Example #2
0
 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)
   });
 }
Example #3
0
 public static string read(CookieIds id, string def = null) {
   HttpCookie cook = HttpContext.Current.Request.Cookies[id.ToString()];
   return cook != null ? cook.Value : def;
 }