This has hit me more than once already. If you create an HTTP Handler (ASHX) file, by default the context object reference (passed in to ProcessRequest) doesn't contain a reference to the Session object, so attempting to access context.Session will fail.
The fix is to add a "using System.Web.SessionState" to the using section, then inherit from the IReadOnlySessionState interface.
Ex.
using System.Web.SessionState;
public class MyAshx : IHttpHandler, IReadOnlySessionState{
}
This will give you read only access to the session state. If you need to add to the session, inherit from IRequiresSessionState instead.
Remember Me
a@href@title, b, i, strike
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.