Modules and Sessions and Events

D

dt

I'm trying to create a drop-in dll that will run as a module on an
existing application with just one web.config change. However, it is
necessary to maintain state within the module. I don't think that I'm
using the events correctly.

Can I only manipulate session between AcquireState and ReleaseState
events? Does that mean in BeginRequest or EndRequest, the session is off
limits? I keep getting "not a reference," and, well, that seems to
corroborate my theory.

Can I RewritePath and intercept status codes elsewhere in the chain,
like PreRequest and PostRequest (hopefully)? Or are there restrictions?
If so, can I roll my own session using BeginRequest and EndRequest?

Is there a better way to handle the desire to RewritePaths based on
session?

Thanks,
-dt
 
S

Scott Allen

Hi dt:

That's right, the Session collection hasn't been associated with the
request until AcquireRequestState.

If you just need to pass information along for the duration of the
request you could use the HttpContext.Items collection. It works just
like the Session, and is available from BeginRequest to EndRequest.
The primary difference is that Items is only available for one
request, then it's gone.

I have some more details here:

The HttpContext Items Collection
http://odetocode.com/Articles/111.aspx
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top