473,396 Members | 2,013 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,396 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 5991
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.