asp.net 怎么保存cookie ???
我浏览器重新打开以后就没有了为什么??HttpCookiehcookie=newHttpCookie("cokkk");hcookie.Expires=DateTime....
我浏览器重新打开以后就没有了 为什么??
HttpCookie hcookie = new HttpCookie("cokkk");
hcookie.Expires = DateTime.Now.AddDays(1);
hcookie.Value = "test cookie";
Response.Cookies.Add(hcookie); 展开
HttpCookie hcookie = new HttpCookie("cokkk");
hcookie.Expires = DateTime.Now.AddDays(1);
hcookie.Value = "test cookie";
Response.Cookies.Add(hcookie); 展开
3个回答
展开全部
应该是你写法错了吧!
你改成这样试一下
string s ="sdfsdfsdf";
HttpCookie hcookie = new HttpCookie("cokkk");
hcookie.Values.Add("test", s);
hcookie.Expires = DateTime.Today.AddDays(1);
hcookie.HttpOnly = true;
Response.AppendCookie(hcookie);
你改成这样试一下
string s ="sdfsdfsdf";
HttpCookie hcookie = new HttpCookie("cokkk");
hcookie.Values.Add("test", s);
hcookie.Expires = DateTime.Today.AddDays(1);
hcookie.HttpOnly = true;
Response.AppendCookie(hcookie);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询