Cookie的赋值和删除

//读取cookie的信息
            var cookies = request.Cookies["yuan_area"];

            if (areaid == null)
            {
                //如果存在cookie的话赋值
                if (cookies != null)
                {
                    areaid = "";
                    cookies.Value = "";
                    cookies.Path = "/";
                    cookies.Domain = ".yuan.cn";
                    cookies.Expires = DateTime.Now.AddDays(-1);
                    Response.SetCookie(cookies);
                }
                else
                {
                    areaid = "";//15,178,1796
                }
            }

你可能感兴趣的:(Cookie的赋值和删除)