HttpModules et session

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
 
T

Teemu Keiski

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top