HttpContext.Current.Session is null in Ashx file
You must add on your handler the IRequiresSessionState on the declaration of it as: public class YourHandleName : IHttpHandler, IRequiresSessionState { … by default the handlers are not connected with the session to keep them minimum, by adding the IRequiresSessionState you attach them with the session.