예제 #1
0
        public void Expire(string key, IHttpCookieOptions options)
        {
            options         = options ?? new HttpCookieOptions();
            options.Expires = DefaultExpires;

            Add(key, null, options);
        }
 /*
  * public void Add(string key, string value) => _cookies.Append(key, value);
  * public void Add(string key, string value, IHttpCookieOptions options) => _cookies.Append(key, value, ToCookieOptions(options));
  * public void Remove(string key) => _cookies.Delete(key);
  * public void Remove(string key, IHttpCookieOptions options) => _cookies.Delete(key, ToCookieOptions(options));
  */
 private static CookieOptions ToCookieOptions(IHttpCookieOptions options)
 {
     return(options as CookieOptions ?? new CookieOptions()
     {
         Domain = options.Domain,
         Expires = options.Expires,
         HttpOnly = options.HttpOnly,
         Path = options.Path,
         Secure = options.Secure
     });
 }
예제 #3
0
 public void Add(string key, string value, IHttpCookieOptions options)
 {
     _cookies.Append(key, value, new CookieOptions()
     {
         Domain   = options.Domain,
         Path     = options.Path,
         Expires  = options.Expires?.DateTime ?? DateTime.MinValue,
         HttpOnly = options.HttpOnly,
         Secure   = options.Secure
     });
 }
 public void Expire(string key, IHttpCookieOptions options)
 {
     _cookies.Delete(key, ToCookieOptions(options));
 }
 public void Add(string key, string value, IHttpCookieOptions options)
 {
     _cookies.Append(key, value, ToCookieOptions(options));
 }