Beispiel #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
   });
 }
Beispiel #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)
   });
 }
Beispiel #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;
 }