首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

问一个cookies存与取值的有关问题

2012-02-24 
问一个cookies存与取值的问题Response.Cookies[username].Value TextBox1.Text.Trim() //保存this.La

问一个cookies存与取值的问题
Response.Cookies["username"].Value = TextBox1.Text.Trim(); //保存 
 this.Label1.Text = "用户名:" + Response.Cookies["username"].Value;//获取  
请问下Cookies是不是这样用? 我是这样写的,但为什么我取值的时候取不到呢。。。

[解决办法]

探讨
引用:
Response.Cookies["username"].Value = TextBox1.Text.Trim(); //保存
Response.Cookies["username"].Expires = DateTime.Now.AddDays(1);//过期时间
this.Label1.Text = "用户名:" + Request.Cookies["username"].Value;//获取

谢谢啦!!!
想请问下 HttpContext.Current.Response.Cookies 和 Response.Cookies 这样有什么区别啊

热点排行