Use Session in Module

  • Thread starter Thread starter The Clansman
  • Start date Start date
T

The Clansman

Hi,
does anyone know how can I use the Session inside a module?? I tried

Dim Session As System.Web.SessionState.HttpSessionState

but I got an error......

thanks,
Bruno
 
check out

System.Web.HttpContext.Current.Session

or

System.Web.HttpContext.Current.Cache

etc
 
Assume you mean in an HttpModule....

You should note Session state is not available in the BeginRequest event
of an HttpModule, it will not have been loaded, session state is only
available after the AcquireRequestState event.

You can either choose to do your processing later, after the
AcquireRequestState event or you can implement an alternative strategy.
I have used HttpContext.Current.Cache and stored session data that is
required in the beginrequest event in a hashtable with each hashtable
indexed using the sessionID which can be retrieved from the session
cookie (HttpContext.Current.Request.Cookies["ASP.NET_SessionId"].Value).
I am sure this is not the ideal solution but it works well and solved me
no end of headaches!

HTH

Matt



"The Clansman" <Yeah! Send me spam!! I love it!! But send the porn
ones....> wrote in message news:[email protected]...
 

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

Back
Top