只有在配置文件或 Page 指令中将 enableSessionState 设置为 true 时

HttpContext context = HttpContext.Current;
//而后,再使用:
if (context.Session["user"] != null)
{

}

 

posted @ 2015-03-19 10:23  bobo-bobo  阅读(296)  评论(0编辑  收藏  举报