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

1 引用这个命名空间

using System.Web.SessionState;

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

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

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

3 使用session

context.Session["user"]

HttpContext.Current.Session["user"]

原文地址:https://www.cnblogs.com/james641/p/4881526.html