Posted on 2007-02-07 21:26
Kylin Bell 阅读(778)
评论(0) 编辑 收藏 引用
当你希望从ashx或HttpHandler里访问你的Session时,你必须实现IReadOnlySessionState接口.
using
System;
using
System.Web;
using
System.Web.SessionState;
public
class
DownloadHandler : IHttpHandler, IReadOnlySessionState
{
public bool IsReusable{get { return true;}}
public void
ProcessRequest(HttpContext ctx)
{
ctx.Response.Write(ctx.Session["UserName"]);
}
}