ASP.NET Response.Cookies

//设置cookie
Response.Cookies["loginPage"].Value = "login.aspx";  //命名并给值
Response.Cookies["loginPage"].Expires = DateTime.MaxValue;  //时间为最大

//读取cookie
string logout = Request.Cookies["loginPage"].Value.ToString();   

//清除cookie
Response.Cookies["loginPage"].Expires = DateTime.Now.AddDays(-1);    //相当于清除

  

posted @ 2016-01-19 15:18  Akgu  阅读(358)  评论(1编辑  收藏  举报