1.引用命名空间
using System.Web.SessionState;
2.继承IRequiresSessionState接口
3.利用httpcontext类读写即可
context.session["XXX"]=XXX;
如果不引用并且继承,则会显示null 错误