Accessing Session State from PreRequestHandlerExecute event

M

matt

I've come across a real problem and am totally stuck as to why this is
happening, hoping desperately that someone else has experienced the same
thing, and knows a solution! Session state should be available from the
PrequestHandlerExecute event, and is most of the time for me however
sometimes asp.net appears not to load session state at this stage. We
have a HttpModule which runs fine 99% of the time however sometimes we
have a problem where by session state fails to load in the above
mentioned event.

We can trap the error by simply checking for a null value for the
session object as below....

HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
HttpSessionState Session = context.Session;

if(Session == null) {
// Trap session is null
} else {
// run required code
}

Session state should be available at this stage as the
AcquireSessionState should have already fired. I guess what would help
is to understand at what times the AcquireSessionState event might not
be fired as normal, or if anyone has any other ideas as to why this
behaviour might occur.

Thanks for any help.

Matt
http://www.3internet.co.uk
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top