Session 在一般处理程序ashx中取值要引用接口 IRequiresSessionState

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;
using System.Data;
using System.Text.RegularExpressions;
using affordableasia.sabre;
using System.Web.SessionState;

public class Handler : IHttpHandler, IRequiresSessionState
{
    
    public void ProcessRequest (HttpContext context) {

    if(context.Request["Key"] !=null)
     {
         string key=   context.Request["Key"] 
         Session["Key"]  session=Session[key] 

           context.Response.ContentType = "text/plain";
           context.Response.Write(price);
      }

        }
    }
}       
需要引用接口 IRequiresSessionState 才能取到值
posted @ 2013-12-12 15:38  看看天上云  阅读(424)  评论(0编辑  收藏  举报