First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« But what price my soul? | Main | .NET Rocks! - PDC Edition »

A reminder to myself and others, when you want to get access to your Session State from an ASHX or HttpHandler, you need to implement IReadOnlySessionState:

<% @ webhandler language="C#" class="DownloadHandler" %>

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["fred"]);
   }
}

Tracked by:
http://radio.weblogs.com/0101015/2003/11/27.html#a1253 [Pingback]


Wednesday, November 12, 2003 2:21:42 PM (Pacific Standard Time, UTC-08:00)
Or IRequiresSessionState if you need read/write access.
Friday, September 30, 2005 1:34:58 AM (Pacific Standard Time, UTC-08:00)
Thanks a lot for this tips :)
pong
Comments are closed.

Contact

Sponsors

Hosting By

On this page...

Tags

Calendar

<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Archives

Google Ads