[轉貼] 泛型處理常式(Generic Handler .ashx) 抓 Session

2012062715:37

出處:http://king971119.blogspot.tw/2010/02/generic-handler-ashx-session.html

using System.Web.SessionState;
public class Handler2 : IHttpHandler, IReadOnlySessionState{

public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Session.Add("XXX", 104);
context.Response.Write(context.Session["XXX"]);

}

public bool IsReusable {
get {
return false;
}
}
}