473,385 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing Session State from PreRequestHandlerExecute event

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
Nov 18 '05 #1
0 3418

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: matt | last post by:
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...
5
by: ASP.Confused | last post by:
As you can tell from my previous posts on this issue...I'm really confused :-/ I have a few ASP.NET web applications on my web host's "https" server. Our web host has a single "bin" folder for...
0
by: themattconnolly | last post by:
I have an application built on virtual pages, where the url is intercepted and a different page is built according to the url. In order to also use forms authentication, I had a Server.Transfer...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
5
by: Miguel | last post by:
ey, I m trying to make a new httpmodule but the session object is null. I m implementing IReadOnlySessionState but it keep on being null. I m novice in this enviroment, does anybody know what's...
1
by: Flinky Wisty Pomm | last post by:
Hi all, I'm tearing my hair out here and I'm desperately hoping someone has a fix. I've got a .Net 2.0 web service for which I need session state, I can't use cookies because I'm using the...
3
by: kingski | last post by:
I have a web site created with ASP.NET 1.1. availability Global.asax: protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
10
by: Nemisis | last post by:
Hi everyone, I am trying to create a custom error page, that the user gets shown when a error has occurred within my website. The code works perfectly, apart from when an invalid URL is typed...
3
by: Mike Gleason jr Couturier | last post by:
Hi, When a user log itself in my web site, I set a cookie. When the use come back after, let's say, a day, I check the cookie and set a value in the user's Session (If the cookie exists). I also...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.