写入Cookie

写入Cookie

        private void SetCookie(string domain)
        {
            HttpCookie cookie = new HttpCookie("token");
            if (!string.IsNullOrEmpty(domain))
                cookie.Domain = domain;
            cookie.Path = "/";
            cookie.Expires = DateTime.Now.AddDays(7);
            cookie.Values.Add("key", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
            Response.Cookies.Add(cookie);
        }
posted @ 2008-05-27 09:26  angushine  阅读(270)  评论(0编辑  收藏  举报