一般处理程序使用Session的方法

1 引用这个命名空间

using System.Web.SessionState;

2 实现这两个接口中的任何一个

IReadOnlySessionState   //此接口只能使用session,无法修改session

IRequiresSessionState    //此接口可以使用session,也可以修改session

3 使用session

context.Session["user"]

HttpContext.Current.Session["user"]

 

posted @ 2015-10-15 10:07  jamess  阅读(461)  评论(0编辑  收藏  举报