cookie和session的设置和读取
一、Cookie
设置 cookie
HttpCookie cookie = new HttpCookie(name);
cookie.Value = user.UserID.ToString();
Response.Cookies.Add(cookie);
读取cookie
System.Web.HttpContext.Current.Request.Cookies[name].Value
二、Session
设置session
HttpContext.Current.Session.Add(name, value);
根据session名获取session对象
HttpContext.Current.Session[name];
posted on 2014-08-13 19:30 huangfenggu 阅读(578) 评论(0) 编辑 收藏 举报