在一般处理程序中使用session时必须继承一下   System.Web.SessionState.IReadOnlySessionState   的接口,否则为会出

"未将对象引用设置到对象的实例。 "

首先需要引用 using System.Web.SessionState;

并实现类的IReadOnlySessionState接口

public class CheckMemberLogin : IHttpHandler,IReadOnlySessionState{

public void ProcessRequest (HttpContext context) {

 if(context.Session["membername"]==null)

{

context.Response.Write("会员已登录");

}

}

}

相关文章:

  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2021-11-26
  • 2021-09-15
  • 2022-01-06
猜你喜欢
  • 2021-09-17
  • 2022-12-23
  • 2022-02-23
  • 2021-10-26
  • 2021-10-10
  • 2021-08-18
相关资源
相似解决方案