在HttpHandlers中使用Session
当你希望从ashx或HttpHandler里访问你的Session时,你必须实现IReadOnlySessionState接口。
using System;
using System.Web;
using System.Web.SessionState;![]()
public class MyHandler : IHttpHandler, IReadOnlySessionState
{
public bool IsReusable{get { return true; }}
public void ProcessRequest(HttpContext ctx)
{
ctx.Response.Write(ctx.Session["UserName"]);
}
}
About this entry
You’re currently reading “在HttpHandlers中使用Session,” an entry on TechLife
- Published:
- 11.29.07 / 11pm
- Category:
- ASP.NET Tips
3 Comments
Jump to comment form | comments rss [?] | trackback uri [?]