Share via


What Is the Lifecycle of a Commerce Server Request?

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

This topic describes how Commerce Server uses the services provided by ASP.NET to process an application request. In particular, it identifies when the CommerceContext is created and how data about the state of the application is added to the CommerceContext:

  1. When a new request is received, the ASP.NET runtime raises the BeginRequest event, and then calls all of the subscribers to the BeginRequest event:

    1. ASP.NET calls the ASP.NET modules that subscribe to the BeginRequest event.

    2. ASP.NET calls the Commerce Server modules that subscribe to the BeginRequest event in the order in which they are defined in the httpModules element in the Web.config file. The CommerceApplicationModule class processes the BeginRequest event first, and creates an instance of the CommerceContext class. Next, the other Commerce Server modules that subscribe to the BeginRequest event process the event. Each module might add state information to the current CommerceContext instance.

  2. ASP.NET runs the Web form.

  3. ASP.NET raises the EndRequest event, and then calls all of the subscribers to the EndRequest event:

    1. ASP.NET calls the Commerce Server modules that subscribe to the EndRequest event in the reverse of the order in which they are defined in the httpModules element in the Web.config file. The Commerce Server modules dispose of any data that they added to the current CommerceContext instance, and then the CommerceApplicationModule class disposes of the current CommerceContext instance itself.

    2. ASP.NET calls the ASP.NET modules that subscribe to the EndRequest event.

See Also

Other Resources

What Is the Lifecycle of a Commerce Server Application?

Web.Config Configuration Settings

Commerce Server and ASP.NET