![]() |
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 "". |
Re: Application_BeginRequest questions
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" <jezbroadsword@blueyonder.co.uk> wrote in message news:uFkY9R2YEHA.2816@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 "". > > > > > > > > |
Re: Application_BeginRequest questions
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" <jezbroadsword@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 "". > > > > > > > |
Re: Application_BeginRequest questions
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]" <NoSpamMgbworld@comcast.netNoSpamM> wrote in message news:uBYELP3YEHA.1000@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" <jezbroadsword@blueyonder.co.uk> wrote in message > news:uFkY9R2YEHA.2816@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 > "". > > > > > > > > > > > > > > > > > > |
| All times are GMT. The time now is 10:45 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.