HttpModules et session

  • Thread starter Thread starter Aurel
  • Start date Start date
A

Aurel

Hi,

I have create a httpmodule but I have some problems. I can't access to the
session. Even if I create my class like this
public class myModule: IHttpModule, IRequiresSessionState
{}

Someone got an idea?
Another question, the session_start in Global.asax fire before all
httpmodules or after all ?!?

Thanks.
Aurel
 
Hi,

first of: IRequiresSessionState is to be used with HttpHandlers (Classes
implementing IHttpHandler interface) to tell that they need Session to be
usable (read/write) and IReadOnlySessionState if HttpHandler needs only
read-only access to the Session. This different fconcept from HttpModules.

So from HttpModule's standpoint, Session is available after
AcquireRequestState event of the HttpApplication is raised. before that you
can't access the Session. It means that in your module you can wire an event
handler in Init method for AcquireRequestState event or some later event to
get access to the Session collection.

Check following article:
http://www.eggheadcafe.com/articles/20030211.asp

It provides you the list and sequence of HttpApplication's events.
 
Back
Top