Google Reviews
If you find this content or our services useful, please leave us a review.

If you just want to read your Session State from an ASHX or HttpHandler, you need to implement IReadOnlySessionState.  If you want to write to your Session State, you must implement IRequiresSessionState.  Note that you will also need use the System.Web.SessionState namespace.  This post describes getting and setting session state in HttpHandlers (ASHX files).

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

using System;
using System.Web;
using System.Web.SessionState;

public class UploadFile : IHttpHandler, IRequiresSessionState
   public bool IsReusable { get { return true; } }
   public void ProcessRequest(HttpContext context)
       string ftpUsername = "ftpUser";
       context.Session["ftpUsername"] = ftpUsername;


Getting and Setting Session State in HttpHandlers (ASHX files)
Comments have now been disabled. If you have a question to ask about this post please ask the community!