记录一下,以备不时之需。
自定义的handler中,默认是不允许访问Session,因此为了访问Session,需要继承IRequiresSessionState 接口,继承之后就可以正常访问Session了
public class tsetaHandler : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
string str=context.Session["abc"];
context.Response.Write(str);
context.Response.End();
}
}