慕娘9325324
设置cookie可以直接使用HttpCookie cookie = new cookie = new HttpCookie(COOKIE_NAME_FOR_USER);cookie.Expires = DateTime.Now.AddYears(1);cookie[COOKIE_USER_NAME] = "用户名";System.Web.HttpContext.Current.Response.Cookies.Add(cookie);取:HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies.Get(COOKIE_NAME_FOR_USER);删除:System.Web.HttpContext.Current.Request.Cookies.Remove(COOKIE_NAME_FOR_USER);另外,判断是否有cookie可以直接使用取的cookie和null进行比较,如果取出来非null就说明不为空