re:
> Is it possible to have programmatic access to the Page object in Application_BeginRequest, or is
> it too early in the lifecycle...?
The problem is that the Application_BeginRequest event is raised for *all* requests.
Are you sure you want that code to execute every time your application receives a request?
Check out the Application Lifecycle Overview at :
http://msdn2.microsoft.com/en-us/library/ms178473.aspx
and the ASP.NET Page Life Cycle Overview, at :
http://msdn2.microsoft.com/en-us/library/ms178472.aspx
I'm sure you'll find a more appropiate application, or page,
event for that code in one of those two pages.
Juan T. Llibre, asp.net MVP
aspnetfaq.com :
http://www.aspnetfaq.com/
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en espaņol :
http://asp.net.do/foros/
===================================
"Mark Rae" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> 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 dynamically, something like:
>
> protected void Application_BeginRequest(Object sender, EventArgs e)
> {
> if (Session["LoggedOn"] == "True")
> {
> <page>.MasterPageFile = "~/loggedOn.master";
> }
> else
> {
> <page>.MasterPageFile = "~/notLoggedOn.master";
> }
> }
>
> N.B. I realise it's possible to achieve the above functionality in other ways - it's just a
> hypothetical example...
>
> Any assistance gratefully received.
>
> Mark
>