I couldn't figure out for a while, why context.Session was always null in my Generic Handler.
I was trying to save my dataset in the session, and it kept failing with "object reference not set to an instance of an object"
In order for the session state to be available to a handler, you need to implement "IRequiresSessionState". So the following fixed it
public class Export : IHttpHandler,System.Web.SessionState.IRequiresSessionState
{
public void ProcessRequest (HttpContext context)
{
....
context.Session["DataSet" ] = ds;
....
}
}
No comments:
Post a Comment