Пример #1
0
        public void Delete(string key, CookieOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            // Assume you can always delete cookies unless directly overridden in the user event.
            var issueCookie = true;

            ApplyPolicy(key, options);
            if (Options.OnDeleteCookie != null)
            {
                var context = new DeleteCookieContext(Context, options, key)
                {
                    IsConsentNeeded = IsConsentNeeded,
                    HasConsent      = HasConsent,
                    IssueCookie     = issueCookie,
                };
                Options.OnDeleteCookie(context);

                key         = context.CookieName;
                issueCookie = context.IssueCookie;
            }

            if (issueCookie)
            {
                Cookies.Delete(key, options);
            }
            else
            {
                _logger.DeleteCookieSuppressed(key);
            }
        }
Пример #2
0
 public ActionResult LogOut()
 {
     Cookies.Delete("usuariologado");
     FormsAuthentication.SignOut();
     Session.Contents.RemoveAll();
     return(RedirectToAction("Login"));
 }
Пример #3
0
 public void Delete(string key)
 {
     if (CheckPolicyRequired() || Options.OnDeleteCookie != null)
     {
         Delete(key, new CookieOptions());
     }
     else
     {
         Cookies.Delete(key);
     }
 }
Пример #4
0
            public void Delete(string key, CookieOptions options)
            {
                if (options == null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                ApplyPolicy(options);
                if (Policy.OnDeleteCookie != null)
                {
                    var context = new DeleteCookieContext(Context, options, key);
                    Policy.OnDeleteCookie(context);
                    key = context.CookieName;
                }
                Cookies.Delete(key, options);
            }
Пример #5
0
 /// <summary>
 /// Delete the key
 /// </summary>
 /// <param name="key">Key</param>
 public void Remove(string key)
 {
     Cookies.Delete(key);
 }