cookie无法存储
if ((Users)Session["currentUser"] != null){
this.lblUser.Text = "";
this.imgbtnComplaint.Enabled = true;
this.imgbtnLink.Enabled = true;
user = (Users)Session["currentUser"];
string userId = "xikemen"+user.UserId.ToString();
if (Request.Cookies[userId] == null)
{
HttpCookie cookieNew = new HttpCookie(userId);
cookieNew.Expires = DateTime.Now.AddDays(30);
cookieNew.Values.Add("Clicked", "");
string ids = Request.QueryString["id"].ToString() + ",";
cookieNew.Values.Add("looked", ids);
//Response.AppendCookie(cookie);
//Response.SetCookie(cookie);
Response.Cookies.Add(cookieNew);
}
else
{
HttpCookie cookieNew = Request.Cookies[userId];
if (cookieNew["looked"] == null)
{
string ids = Request.QueryString["id"].ToString() + ",";
cookieNew.Values.Add("looked", ids);
}
else
{
if (cookieNew["looked"].Contains(Request.QueryString["id"].ToString()))
{
}
else
{
cookieNew["looked"] += Request.QueryString["id"].ToString() + ",";
}
}
// Response.AppendCookie(cookie);
Response.Cookies.Add(cookieNew);
//Response.SetCookie(cookie);
}
我写的这样一段代码 请问是不是哪里有问题?为什么cookie无法存储到客户端?