Welcome to MSDN Blogs Sign in | Join | Help
IHttpHandler and Session

As a follow-up to yesterday's post, I needed the ImageRequestHandler to retrieve data from an external source, rather than always generating the same graph. For some reason, though, the Session object inside ProcessRequest's HttpContext was always null.

It turns out that you need to mark your class with IReadOnlySessionState or IRequiresSessionState if you want access to Session.

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

            // context.Session isn't NULL anymore!
        }
   }

Just leaving this information here in case I need it in future :)

Posted: Tuesday, January 09, 2007 8:30 AM by casper
Filed under:

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker