Cookie的读写

记住怎么写就可以了,不要问我为什么=_=

1 设置值的页面:context.Response.SetCookie(new HttpCookie("username",username) {Expires=DateTime.Now.AddDays(7) }); //保存7天
2 读取值的页面:username= Request.Cookies["UserName"].Value;

 

posted @ 2016-09-01 20:46  一直乱跑的熊  阅读(167)  评论(0编辑  收藏  举报