在.ashx中使用Session

 继承System.Web.SessionState.IRequiresSessionState,使Session拥有读取和写入权限

public class BankPay : IHttpHandler,System.Web.SessionState.IRequiresSessionState

    {

        public void ProcessRequest(HttpContext context)

        {        

           context.Response.End();

        }

        public bool IsReusable

        {

            get

            {

                return false;

            }

        }

    }

参照

http://www.cnblogs.com/over140/archive/2008/12/27/1363491.html

http://msdn.microsoft.com/zh-tw/library/system.web.sessionstate.irequiressessionstate.aspx

原文地址:https://www.cnblogs.com/huangtailang/p/2207295.html