Modules and Sessions and Events

Discussion in 'ASP .Net' started by dt, Jun 28, 2005.

  1. dt

    dt Guest

    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
     
    dt, Jun 28, 2005
    #1
    1. Advertisements

  2. dt

    Scott Allen Guest

    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
     
    Scott Allen, Jun 29, 2005
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.