在一般处理程序中使用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("会员已登录");

}

}

}

posted on 2009-11-09 10:08  cean  阅读(292)  评论(0编辑  收藏  举报