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

Application_BeginRequest questions

1) How can I access my object-oreinted classes from the global.asax
Application_BeginRequest event ?
I cannot instantiate them from session since it complains :
Session state is not available in this context

2) How can I get the name of the Page being requested from within
Application_BeginRequest ?
((System.Web.UI.Page)HttpContext.Current.Handler). ToString() returns "".


Nov 18 '05 #1
3 5987
Properties on Request.Url should be able to give you the path and page
being requested.

If your object is kept in the Session object, you just won't be able
to get to it from BeginRequest. Perhaps you might want to check out
the Items collection, I have some sample code here:

http://www.odetocode.com/Articles/111.aspx

--
Scott
http://www.OdeToCode.com

On Tue, 6 Jul 2004 15:21:10 +0100, "JezB"
<je***********@blueyonder.co.uk> wrote:
1) How can I access my object-oreinted classes from the global.asax
Application_BeginRequest event ?
I cannot instantiate them from session since it complains :
Session state is not available in this context

2) How can I get the name of the Page being requested from within
Application_BeginRequest ?
((System.Web.UI.Page)HttpContext.Current.Handler). ToString() returns "".



Nov 18 '05 #2
Request.Url will give you the full path. You can tear that down to get a
specific page.

If you posted the actual problem, sans the proposed solution (using App_BR),
you might get some better architectural guidelines for this problem.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
1) How can I access my object-oreinted classes from the global.asax
Application_BeginRequest event ?
I cannot instantiate them from session since it complains :
Session state is not available in this context

2) How can I get the name of the Page being requested from within
Application_BeginRequest ?
((System.Web.UI.Page)HttpContext.Current.Handler). ToString() returns "".


Nov 18 '05 #3
I have found that I can do what I want in global.asax's
Application_PreRequestHandlerExecute event, since this has Session
available. I'm puzzled why Application_BeginRequest doesn't though.

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:uB**************@TK2MSFTNGP12.phx.gbl...
Request.Url will give you the full path. You can tear that down to get a
specific page.

If you posted the actual problem, sans the proposed solution (using App_BR), you might get some better architectural guidelines for this problem.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"JezB" <je***********@blueyonder.co.uk> wrote in message
news:uF**************@TK2MSFTNGP11.phx.gbl...
1) How can I access my object-oreinted classes from the global.asax
Application_BeginRequest event ?
I cannot instantiate them from session since it complains :
Session state is not available in this context

2) How can I get the name of the Page being requested from within
Application_BeginRequest ?
((System.Web.UI.Page)HttpContext.Current.Handler). ToString() returns

"".




Nov 18 '05 #4

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

Similar topics

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...
1
by: JezB | last post by:
1) How can I access my object-oreinted classes from the global.asax Application_BeginRequest event ? I cannot instantiate them from session since it complains : Session state is not available in...
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...
1
by: Leon | last post by:
Please help, what I'm I doing wrong????? --> This following code will not run correctly, no syntax errors, but.. --> execution error = The subdomain does not exist in database.... "but it does in...
7
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user...
0
by: Rahul | last post by:
Earlier this evening i posted a question that my debug point is hit several times, But after I published the application. I could significantly see less round trip per request for Application_Begin...
19
by: Mark Rae | last post by:
Hi, Is it possible to have programmatic access to the Page object in Application_BeginRequest, or is it too early in the lifecycle...? E.g. to be able to change a page's MasterPage...
3
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I've used an Application_BeginRequest function in my global.asax page to implement some URL rewriting functionality on our website. However, upon moving it to my host (1&1.co.uk), it...
7
by: Joe | last post by:
I'm trying to use the Application_BeginRequest to re-write the path but it doesn't work on the published site when a non-existing URL is called. This does work fine in my dev environment. For...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.