Why is HttpContext.Current.Session available in HttpModule but not in Response.Filter?
        Posted  
        
            by Abtin Forouzandeh
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Abtin Forouzandeh
        
        
        
        Published on 2010-03-31T21:12:05Z
        Indexed on 
            2010/03/31
            21:13 UTC
        
        
        Read the original article
        Hit count: 318
        
I have written an HttpModule that adds a response filter. The filter is capturing page output and storing it in a session variable.
- I am able to access HttpContext.Current.Session in my HttpModule.
- The HttpModule is handling the PostAcquireRequestState event.
- I am still able to access HttpContext.Current.Session in the PostAcquireRequestState event.
- I am adding a custom stream that inherits from Stream to Response.Filter
- HttpContext.Current.Session is null when accessed from the Stream.Write method.
Everything worked fine when using an InProc SessionState. However, I now must use StateServer. Using StateServer, the code is now broken.
Any ideas?
© Stack Overflow or respective owner