示例#1
0
        public HttpCookie SetCookie(string name, string value, string domain, DateTime expires)
        {
            if (name == null)
                throw new ArgumentNullException ("name");
            if (value == null)
                throw new ArgumentNullException ("value");

            var cookie = new HttpCookie (name, value);

            cookie.Domain = domain;
            cookie.Expires = expires;

            SetCookie (name, cookie);
            return cookie;
        }
示例#2
0
 public void SetCookie(string name, HttpCookie cookie)
 {
     Cookies [name] = cookie;
 }
示例#3
0
        public HttpCookie SetCookie(string name, string value)
        {
            if (name == null)
                throw new ArgumentNullException ("name");
            if (value == null)
                throw new ArgumentNullException ("value");

            var cookie = new HttpCookie (name, value);

            SetCookie (name, cookie);
            return cookie;
        }
示例#4
0
        public void RemoveCookie(string name)
        {
            var cookie = new HttpCookie (name, "");
            cookie.Expires = DateTime.Now.AddYears(-1);

            SetCookie (name, cookie);
        }