.Net 2.0: Session not available in HttpModule RRS feed

  • Question

  • User355931397 posted

    I am having a problem whereby Session is always null in a HttpModule I have written.

    I am hooking to the PreRequestHandlerExecute event:

    public void Init(HttpApplication httpApp)
      httpApp.PreRequestHandlerExecute += new EventHandler(httpApp_PreRequestHandlerExecute);

    void httpApp_PreRequestHandlerExecute(object sender, EventArgs e)
       // ** session always null here:

    HOWEVER, if I code this directly into Global.asax, I *can* get session:

    void Application_PreRequestHandlerExecute(object sender, EventArgs e)
       // ** session is OK here:

    I have added my HttpModule to web.config, I have also tried explicitly adding the System.Web.SessionState.SessionStateModule to web.config, but to no avail.

    Can anyone see what the problem is??


    Adam Webber
    Sunday, April 9, 2006 8:52 PM

All replies

  • User933648302 posted
    you have to implement IRequireSessionState
    Sunday, April 9, 2006 9:48 PM