Event sequence

Discussion in 'ASP .Net' started by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Nov 9, 2006.

  1. You would think this list exists but I can’t find it anywhere. Is this the
    correct order for these events to be called?

    Global.asax Application_Start (only once)
    Global.asax Application_Init (initialize for app here – can be called
    multiple times)

    BeginRequest
    AuthenticateRequest
    PostAuthenticateRequest
    AuthorizeRequest
    PostAuthorizeRequest
    ResolveRequestCache
    PostResolveRequestCache
    After the PostResolveRequestCache event and before the PostMapRequestHandler
    event, an event handler (a page corresponding to the request URL) is created.
    PostMapRequestHandler
    AcquireRequestState
    Global.asax Session_OnStart (if needed)
    PostAcquireRequestState
    PreRequestHandlerExecute
    The event handler is executed.
    PostRequestHandlerExecute
    ReleaseRequestState
    PostReleaseRequestState
    After the PostReleaseRequestState event, response filters, if any, filter
    the output.
    UpdateRequestCache
    PostUpdateRequestCache
    EndRequest (always called)

    Global.asax Session_OnEnd (on timeout – always after all of the above)

    Global.asax Application_Dispose (called once for each Application_Init)
    Global.asax Application_End (only once)

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com

    Cubicle Wars - http://www.windwardreports.com/film.htm
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Nov 9, 2006
    #1
    1. Advertising

  2. It is here: http://msdn2.microsoft.com/en-us/library/ms178472.aspx

    --
    ________________________
    Warm regards,
    Alvin Bruney [MVP ASP.NET]

    [Shameless Author plug]
    Professional VSTO.NET - Wrox/Wiley
    The O.W.C. Black Book with .NET
    www.lulu.com/owc, Amazon
    Blog: http://www.msmvps.com/blogs/alvin
    -------------------------------------------------------


    "David Thielen" <> wrote in message
    news:...
    > You would think this list exists but I can't find it anywhere. Is this the
    > correct order for these events to be called?
    >
    > Global.asax Application_Start (only once)
    > Global.asax Application_Init (initialize for app here - can be called
    > multiple times)
    >
    > BeginRequest
    > AuthenticateRequest
    > PostAuthenticateRequest
    > AuthorizeRequest
    > PostAuthorizeRequest
    > ResolveRequestCache
    > PostResolveRequestCache
    > After the PostResolveRequestCache event and before the
    > PostMapRequestHandler
    > event, an event handler (a page corresponding to the request URL) is
    > created.
    > PostMapRequestHandler
    > AcquireRequestState
    > Global.asax Session_OnStart (if needed)
    > PostAcquireRequestState
    > PreRequestHandlerExecute
    > The event handler is executed.
    > PostRequestHandlerExecute
    > ReleaseRequestState
    > PostReleaseRequestState
    > After the PostReleaseRequestState event, response filters, if any, filter
    > the output.
    > UpdateRequestCache
    > PostUpdateRequestCache
    > EndRequest (always called)
    >
    > Global.asax Session_OnEnd (on timeout - always after all of the above)
    >
    > Global.asax Application_Dispose (called once for each Application_Init)
    > Global.asax Application_End (only once)
    >
    > --
    > thanks - dave
    > david_at_windward_dot_net
    > http://www.windwardreports.com
    >
    > Cubicle Wars - http://www.windwardreports.com/film.htm
    >
    >
    Alvin Bruney [MVP], Nov 9, 2006
    #2
    1. Advertising

  3. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/Internals.asp

    will give a few more events to add to your list

    -- bruce (sqlwork.com)

    "David Thielen" <> wrote in message
    news:...
    > You would think this list exists but I can't find it anywhere. Is this the
    > correct order for these events to be called?
    >
    > Global.asax Application_Start (only once)
    > Global.asax Application_Init (initialize for app here - can be called
    > multiple times)
    >
    > BeginRequest
    > AuthenticateRequest
    > PostAuthenticateRequest
    > AuthorizeRequest
    > PostAuthorizeRequest
    > ResolveRequestCache
    > PostResolveRequestCache
    > After the PostResolveRequestCache event and before the
    > PostMapRequestHandler
    > event, an event handler (a page corresponding to the request URL) is
    > created.
    > PostMapRequestHandler
    > AcquireRequestState
    > Global.asax Session_OnStart (if needed)
    > PostAcquireRequestState
    > PreRequestHandlerExecute
    > The event handler is executed.
    > PostRequestHandlerExecute
    > ReleaseRequestState
    > PostReleaseRequestState
    > After the PostReleaseRequestState event, response filters, if any, filter
    > the output.
    > UpdateRequestCache
    > PostUpdateRequestCache
    > EndRequest (always called)
    >
    > Global.asax Session_OnEnd (on timeout - always after all of the above)
    >
    > Global.asax Application_Dispose (called once for each Application_Init)
    > Global.asax Application_End (only once)
    >
    > --
    > thanks - dave
    > david_at_windward_dot_net
    > http://www.windwardreports.com
    >
    > Cubicle Wars - http://www.windwardreports.com/film.htm
    >
    >
    bruce barker \(sqlwork.com\), Nov 9, 2006
    #3
  4. That link seems to be for ASP.NET 3.0. It doesn't appear to list the actual
    events. Or am I missing something?

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com

    Cubicle Wars - http://www.windwardreports.com/film.htm




    "Alvin Bruney [MVP]" wrote:

    > It is here: http://msdn2.microsoft.com/en-us/library/ms178472.aspx
    >
    > --
    > ________________________
    > Warm regards,
    > Alvin Bruney [MVP ASP.NET]
    >
    > [Shameless Author plug]
    > Professional VSTO.NET - Wrox/Wiley
    > The O.W.C. Black Book with .NET
    > www.lulu.com/owc, Amazon
    > Blog: http://www.msmvps.com/blogs/alvin
    > -------------------------------------------------------
    >
    >
    > "David Thielen" <> wrote in message
    > news:...
    > > You would think this list exists but I can't find it anywhere. Is this the
    > > correct order for these events to be called?
    > >
    > > Global.asax Application_Start (only once)
    > > Global.asax Application_Init (initialize for app here - can be called
    > > multiple times)
    > >
    > > BeginRequest
    > > AuthenticateRequest
    > > PostAuthenticateRequest
    > > AuthorizeRequest
    > > PostAuthorizeRequest
    > > ResolveRequestCache
    > > PostResolveRequestCache
    > > After the PostResolveRequestCache event and before the
    > > PostMapRequestHandler
    > > event, an event handler (a page corresponding to the request URL) is
    > > created.
    > > PostMapRequestHandler
    > > AcquireRequestState
    > > Global.asax Session_OnStart (if needed)
    > > PostAcquireRequestState
    > > PreRequestHandlerExecute
    > > The event handler is executed.
    > > PostRequestHandlerExecute
    > > ReleaseRequestState
    > > PostReleaseRequestState
    > > After the PostReleaseRequestState event, response filters, if any, filter
    > > the output.
    > > UpdateRequestCache
    > > PostUpdateRequestCache
    > > EndRequest (always called)
    > >
    > > Global.asax Session_OnEnd (on timeout - always after all of the above)
    > >
    > > Global.asax Application_Dispose (called once for each Application_Init)
    > > Global.asax Application_End (only once)
    > >
    > > --
    > > thanks - dave
    > > david_at_windward_dot_net
    > > http://www.windwardreports.com
    > >
    > > Cubicle Wars - http://www.windwardreports.com/film.htm
    > >
    > >

    >
    >
    >
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Nov 10, 2006
    #4
  5. That link has a totally different list of events as they happen. I assum that
    is what is happening under the covers but it is not events an app can get???

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com

    Cubicle Wars - http://www.windwardreports.com/film.htm




    "bruce barker (sqlwork.com)" wrote:

    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/Internals.asp
    >
    > will give a few more events to add to your list
    >
    > -- bruce (sqlwork.com)
    >
    > "David Thielen" <> wrote in message
    > news:...
    > > You would think this list exists but I can't find it anywhere. Is this the
    > > correct order for these events to be called?
    > >
    > > Global.asax Application_Start (only once)
    > > Global.asax Application_Init (initialize for app here - can be called
    > > multiple times)
    > >
    > > BeginRequest
    > > AuthenticateRequest
    > > PostAuthenticateRequest
    > > AuthorizeRequest
    > > PostAuthorizeRequest
    > > ResolveRequestCache
    > > PostResolveRequestCache
    > > After the PostResolveRequestCache event and before the
    > > PostMapRequestHandler
    > > event, an event handler (a page corresponding to the request URL) is
    > > created.
    > > PostMapRequestHandler
    > > AcquireRequestState
    > > Global.asax Session_OnStart (if needed)
    > > PostAcquireRequestState
    > > PreRequestHandlerExecute
    > > The event handler is executed.
    > > PostRequestHandlerExecute
    > > ReleaseRequestState
    > > PostReleaseRequestState
    > > After the PostReleaseRequestState event, response filters, if any, filter
    > > the output.
    > > UpdateRequestCache
    > > PostUpdateRequestCache
    > > EndRequest (always called)
    > >
    > > Global.asax Session_OnEnd (on timeout - always after all of the above)
    > >
    > > Global.asax Application_Dispose (called once for each Application_Init)
    > > Global.asax Application_End (only once)
    > >
    > > --
    > > thanks - dave
    > > david_at_windward_dot_net
    > > http://www.windwardreports.com
    > >
    > > Cubicle Wars - http://www.windwardreports.com/film.htm
    > >
    > >

    >
    >
    >
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Nov 10, 2006
    #5
  6. Hello Dave,

    The article Alvin mentioned describes the life cycle and events of ASP.NET
    page.

    The following one has detailed describes the application & pipeline level
    events and their fire sequence:

    #ASP.NET Application Life Cycle Overview
    http://msdn2.microsoft.com/en-us/library/ms178473.aspx

    Actually, Application_Start and Application_End events are only fired once
    during the ASP.NET application's lifetime.


    The Application.Init and Dispose event are two event specific to each
    HttpApplication class(and our global.asax class which derive from
    HttApplication). And for each ASP.NET request, there will has a dedicated
    HttpAppliction instance associated with it, so the "Init" and "Dispose"
    event fires once for each ASP.NET request.

    Also, for other events listed, they also fires once in each ASP.NET
    request, but they're more coupled with ASP.NET's server-side pipeline where
    we can do some customization on the request.

    Hope this helps. If there is anything unclear, please feel free to post
    here.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Nov 10, 2006
    #6
  7. Hi;

    I may be missing it but I don't see in there where in the application events
    the Init, SessionStart, and Dispose are called. Yes they are only called the
    first/last time but if you need the Session object in an application event,
    you need to know when you can assume it exists.

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com

    Cubicle Wars - http://www.windwardreports.com/film.htm




    "Steven Cheng[MSFT]" wrote:

    > Hello Dave,
    >
    > The article Alvin mentioned describes the life cycle and events of ASP.NET
    > page.
    >
    > The following one has detailed describes the application & pipeline level
    > events and their fire sequence:
    >
    > #ASP.NET Application Life Cycle Overview
    > http://msdn2.microsoft.com/en-us/library/ms178473.aspx
    >
    > Actually, Application_Start and Application_End events are only fired once
    > during the ASP.NET application's lifetime.
    >
    >
    > The Application.Init and Dispose event are two event specific to each
    > HttpApplication class(and our global.asax class which derive from
    > HttApplication). And for each ASP.NET request, there will has a dedicated
    > HttpAppliction instance associated with it, so the "Init" and "Dispose"
    > event fires once for each ASP.NET request.
    >
    > Also, for other events listed, they also fires once in each ASP.NET
    > request, but they're more coupled with ASP.NET's server-side pipeline where
    > we can do some customization on the request.
    >
    > Hope this helps. If there is anything unclear, please feel free to post
    > here.
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    > ==================================================
    >
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    >
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Nov 10, 2006
    #7
  8. Thanks for Mark's informative input.

    Hi Dave,

    I think you don't need to care about the Init and dispolse event since
    they're specific to HttpApplicationclass's instance creation and
    termination rather than ASP.NET request lifecycle.

    As for Session's OnStart and OnEnd, certianly it won't occur in each
    requests and will fire depend on the current request's status. To further
    explain it, we should start from how SessionState management is implemented
    in ASP.NET, open the "web.config" in the framework folder, you'll find the
    SessionState management is done through the "SessionStateModule" httpmodule
    configured as below:


    ==============
    <httpModules>
    <add name="OutputCache"
    type="System.Web.Caching.OutputCacheModule" />
    <add name="Session"
    type="System.Web.SessionState.SessionStateModule" />
    <add name="WindowsAuthentication"
    type="System.Web.Security.WindowsAuthenticationModule" />
    <add name="FormsAuthentication"
    type="System.Web.Security.FormsAuthenticationModule" />
    ...................
    ...................
    </httpModules>
    ================


    In the module's processing methods, it will check session's status(from
    cookie or url string) and determine whether to create a new session or
    reset the current session's timeout window.... You can use reflector to
    insepect the methods of SessionStateModule for a thorough idea on how it
    works.

    Hope this helps some.



    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Nov 10, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guadala Harry

    PostBack Event Firing Sequence

    Guadala Harry, Aug 15, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,017
    Bredal Jensen
    Aug 15, 2004
  2. Josh

    Event Sequence Wrong

    Josh, Aug 17, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    398
    Eliyahu Goldin
    Aug 17, 2005
  3. =?Utf-8?B?SmF5?=
    Replies:
    3
    Views:
    956
    Kevin Spencer
    Dec 21, 2005
  4. Phillip N Rounds

    Question re Event Firing Sequence

    Phillip N Rounds, Mar 1, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    394
    Eliyahu Goldin
    Mar 5, 2006
  5. stef mientki
    Replies:
    13
    Views:
    616
    stef mientki
    Oct 20, 2007
Loading...

Share This Page