ashx中实现session功能需要继承"System.Web.SessionState.IRequiresSessionState"接口
using System;
using System.Collections.Generic;
using System.Web;
namespace WebApplication2
{
/// <summary>
/// Summary description for Handler1
/// </summary>
public class Handler1 : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable
{
get
{
return false;
}
}
}
}