Ejemplo n.º 1
0
        public void Append(string key, string value, CookieOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var issueCookie = CanTrack || options.IsEssential;

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

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

            if (issueCookie)
            {
                Cookies.Append(key, value, options);
            }
        }
Ejemplo n.º 2
0
            public void Append(string key, string value, CookieOptions options)
            {
                if (options == null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                ApplyPolicy(options);
                if (Policy.OnAppendCookie != null)
                {
                    var context = new AppendCookieContext(Context, options, key, value);
                    Policy.OnAppendCookie(context);
                    key   = context.CookieName;
                    value = context.CookieValue;
                }
                Cookies.Append(key, value, options);
            }
Ejemplo n.º 3
0
        private bool ApplyAppendPolicy(ref string key, ref string value, CookieOptions options)
        {
            var issueCookie = CanTrack || options.IsEssential;

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

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

            return(issueCookie);
        }
Ejemplo n.º 4
0
            public void Append(string key, string value, CookieOptions options)
            {
                if (options == null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                ApplyPolicy(options);
                if (Policy.OnAppendCookie != null)
                {
                    var context = new AppendCookieContext(Context, options, key, value);
                    Policy.OnAppendCookie(context);
                    key = context.CookieName;
                    value = context.CookieValue;
                }
                Cookies.Append(key, value, options);
            }