473,326 Members | 2,111 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,326 software developers and data experts.

Session not available in Application_PreRequestHandlerExecute

After converting my project to ASP.NET 2.0 any reference to the Session[]
object returns a null reference within Application_PreRequestHandlerExecute
events.

This worked fine in APS.NET 1.1, so can anyone please recommend an
alternative method of achieving the following functionality:

Under certain circumstances I want to redirect users away from default.aspx
to another page. The decision on whether to do this is made according to a
value set in Session[].

Many thanks

Ben

Feb 11 '06 #1
1 4943
I must add to my previous post that testing if session does not equal null results in an error too.

Ie

protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e) {
if (Session != null) { // <-- throws error
}
}

Ben
"Ben Fidge" <be*******@nospambtopenworld.com> wrote in message news:Od*************@tk2msftngp13.phx.gbl...
After converting my project to ASP.NET 2.0 any reference to the Session[]
object returns a null reference within Application_PreRequestHandlerExecute
events.

This worked fine in APS.NET 1.1, so can anyone please recommend an
alternative method of achieving the following functionality:

Under certain circumstances I want to redirect users away from default.aspx
to another page. The decision on whether to do this is made according to a
value set in Session[].

Many thanks

Ben


Feb 11 '06 #2

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

Similar topics

0
by: Jasmine | last post by:
Hi, The application is using Form authentication. in the Application_PreRequestHandlerExecute, I check if the context.current. user.Identity has content, and the principle haven't been added...
3
by: Paul Daly (MCP) | last post by:
I'm trying to write a log file that captures the referring url if the request is a new session, and captures a querystring value if the user is browsing between pages on the website. When using...
2
by: jakk | last post by:
Iam storing the session state in SQL Server. The Session gets stored in the SQL Server temp tables ( I can see some values in the two tables), but the session doesnt seem to timeout. We have a...
2
by: Stu | last post by:
Hi, I am trying to access session variable value from the 'Application_BeginRequest' handler in the global asax file but get the message - 'Session state not available in this context'. I have...
2
by: stewartfip | last post by:
My global.asax file looks something like this: sub Session_Start() session("sessionID") = end sub sub Application_PreRequestHandlerExecute() if session("sessionID") <> 0 then
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)
1
by: kingski | last post by:
I have a web page (Asp.net 2.0, vs2005) in which there is this construction: <img src="/pages/showimage.aspx"> In global.asax I access sessions in Application_PreRequestHandlerExecute event. ...
0
by: Pinku | last post by:
Hi Guys, I'm going crazy with a problem. I have a web application that do something in Application_PreRequestHandlerExecute, in this Method I use Session and I have no problem about it. I...
9
by: Robbe Morris - [MVP] C# | last post by:
For reasons I won't get into here, I'd be curious if anyone has tried to write an ASP.NET 2.0 site that could restrict the number of active sessions before disabling the application. By disable,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.