Page lifecycle, specific events question.



I have a page that inherits from a base page that is currently
overriding all of the On* events. For the most part I'm accomplishing
everything I set out to do with the inheritance, but I wanted to get a
little more information to lock down what I think I know and also to
answer a couple little questions.

Given a base page, and the page inheriting it, as I understand it, the
page lifecycle flows like this:

1) Page is requested
2) Base page OnPreInit is called
3) Base page OnInit is called
4) Main page OnInit is called
5) ViewState is loaded
6) Base page OnPreLoad is called
7) Base page OnLoad is called
8) Main page OnLoad is called
9) Control postback events are processed
10) Base page OnLoadCompleted is called
11) Base page OnPreRender is called
12) Main page OnPreRender is called
13) Base page OnPreRenderComplete is called
14) ViewState is rendered
15) Base page OnUnload is called
16) Main page OnUnload is called.

I have run into some problems with Session though, not being available
during the Base page OnInit until after I have called base.OnInit(e).
My understanding is that Session should always be available, but I
also understand that it can't be available until after the cookies are
available, as the session id is derived from the cookie (and yes, I
know that Session is the root of all evils, but we are working to get
away from them in this app).

So is 1) the above sequence for page lifecycle correct and 2) what is
the session lifecycle on a page (i.e. when does it come in and out of
scope)?

Any help would be greatly appreciated.

Gary

.



Relevant Pages

  • Object loaded in Page & UserControl... not sure if i"m doing this right...
    ... Essentially what it does is load a user profile from a session and exposes it via a public property. ... I have user controls that require the profile as well and I was coding it to work in the same way (created a class that inherits the System.Web.UI.UserControl class. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Thread not working
    ... So only one request for one session can come in. ... Second request will be ... will not end the lifecycle you ... "Jason Chu" < ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session Start / Application_BeginRequest Issues
    ... where can I find a complete listing of all of the events that occur during the lifecycle of a web application including Application_PreRequestHandlerExecute ... "Craig Deelsnyder" wrote: ... >> request is a new session, and captures a querystring value if the user ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session Variables - HELP !!
    ... and clean up your session management too. ... define exactly what the user's session needs to look like for the ... 'This shared property manages the class's lifecycle for you ... > A process will then retrieve that dataset and add a row and store the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session Variables - HELP !!
    ... indeed it makes life and code far more straight forward with Session ... "David Jessee" wrote: ... > that class to manage its own lifecycle. ... > Public Property ShoppingCart as Dataset ...
    (microsoft.public.dotnet.framework.aspnet)

Loading