Exemplo n.º 1
0
        public object this[object key]
        {
            get
            {
                string cookie = null;
                if (key is int keyCode)
                {
                    cookie = _cookiecollection[keyCode.ToString()];
                }
                else
                {
                    cookie = _cookiecollection[(string)key];
                }

                if (cookie == null)
                {
                    return("");
                }

                if (_request)
                {
                    return(new AspReadCookie(cookie));
                }
                else
                {
                    return(new AspWriteCookie(cookie));
                }
            }

            set
            {
                if (value == null || (value is string && string.IsNullOrEmpty((string)value)))
                {
                    _cookiecollection.Remove(key.ToString());
                }
            }
        }