Page Flow Application Block
You can use the Page Flow Application Block to easily design the parts of your application that orchestrate the Web pages that allow a user to fulfill some process. You can use the application block for simple processes, where the sequence of activities is fixed. You can also use the application block for complex scenarios, where the sequence of activities can be altered by user interaction or by event-driven business processes and the exact sequence of activities is determined at run time.
Consider a workflow where an employee can transfer funds from a bank account. If the amount is less than a specified limit, the transfer is executed immediately. If the amount is greater than the limit, the transfer requires approval. The following code represents the required code to orchestrate the pages.
public void AttemptTransfer(decimal transferAmount)
if (transferAmount > MaxAmountWithoutApproval)
If requirements change and a new, intermediate page is to be displayed, you must modify the application code. If you write this code in a presenter class (instead of a controller class), it can be difficult to locate all relevant navigation calls. Additionally, you couple one view-presenter pair with another view-presenter pair. For information about patterns related to use of the Page Flow Application Block
, see View-Presenter and Application Controller.
You can use the application block to create a page flow definition for the presentation process. This definition can include conditional branches and rules, and you can write code similar to the following for this scenario (StorePageFlow is a running instance of a page flow definition).
public void AttemptTransfer(decimal transferAmount)
StorePageFlow.UserData["TransferAmount "] = transferAmount;
If the requirements change, the developer can update the page flow definition. When you use the Windows Workflow Foundation Page Flow Provider, you can do this with the Visual Studio 2005 Designer for Windows Workflow Foundation. This means it is possible to change the page flow without changing application code that you write.
Note: You can choose to supplement the page flow definition with code in your controller. For
example, you can have complex rules expressed in source code that affect the page flow. If you do
this, you may have to change source code to update the page flow.
The following are the goals of the Page Flow Application Block:
- Works with Windows Workflow Foundation. The application block contains a page flow provider that uses Windows Workflow Foundation. You can define page flows in the Workflow Designer and use Windows Workflow Foundation to execute the page flows.
- Pluggable. The page flow engine adopts the standard .NET Framework provider model to load the page flow provider implementation and page flow instance store implementation.
Note: The application block contains a single page flow provider. This provider uses Windows
Workflow Foundation as the page flow engine.
- Simple and intuitive developer model. The application code provides a similar development and programming model for both the application page flow developer and the application component developer. Make common and simple scenarios easy to accomplish and easy to understand.
The following are the non-goals for this application block:
- Works well within different application domains. The application block targets ASP.NET applications. It is not a goal to support console applications, Windows Forms, or Avalon forms-based applications.
- Works with existing User Interface Process (UIP) Application Block applications. You must modify UIP applications to use the application block. For migration guidance, see Migrating from the UIP Application Block and Page Flow with Shopping QuickStart.
Scenarios and Requirements
The following list contains the primary page flow scenarios targeted by this release of the application block:
- Page navigation. The Page Flow Application Block supports a wide range of interaction patterns. It accommodates sequential navigation between Web pages in addition to graph-like processes that use control structures (such as conditional branches) to deviate from linear flow. For example, the presentation process for an application shows different options for users in different roles.
- Back button. Developers of Web client applications must handle the back button in a way that is consistent with users' expectations and the business process. For a presentation process, the back button typically translates into rewinding the associated business activity. For example, a page flow for a funds transfer prevents the user from reprocessing the transfer if the browser's back button is used (or if the user types a URL directly into the browser). Other use cases can allow the user to use the back button to navigate. Developers can use the Page Flow Application Block to define the desired behavior for each page flow definition.
- Data-driven navigation. Many user interactions are driven by user-supplied information. The Page Flow Application Block allows applications to supply information that the application block uses internally to determine the appropriate page flow. For example, a Web client application for electronic funds transfers prompts for a second confirmation only if the amount entered by the user is greater than the set limit.
- Page flow composition. Using page flow, you can reuse entire presentation processes. You can compose larger page flows from other page flows. For example, a page flow for the checkout process of an e-commerce site invokes another page flow for credit card payment by passing data to that page flow (and receiving data back from the page flow when it completes).
- Suspend and resume. Frequently, developers want to create applications that allow users to pause complex operations and resume them later. Similarly, the application can be resilient to session expiration (for example, when it times out or when the user closes the browser). The Page Flow Application Block provides support for suspending and resuming the presentation process. For example, a page flow for defining an investment portfolio that involves many steps and information allows users to suspend it in the middle of the process and resume it at a later time.
- Abandonment. A developer can use the Page Flow Application Block to easily specify whether the user can leave (abandon) the page flow before it is completed. The developer can specify whether a user can resume an abandoned page flow or if the page flow is discarded. For example, the page flow implementing the checkout on an e-commerce site prevents users from navigating to a page outside the page flow.
- Constraining a page flow. Some presentation processes require a strict sequence of Web pages. The application block allows you to define whether a page flow is constrained or unconstrained. In a constrained page flow, all transitions are performed by the application code. The user cannot enter a URL (or click a hyperlink) for a page to navigate to a new page. If the user attempts to do so, the application block redirects the user back to the appropriate page.
Scenarios Not in Scope
This version of the Page Flow Application Block does not include support for the following scenarios:
- Progress indicators (also known as "bread crumbs")
- Pop-up windows
- Shared transitions between different page flows
- Query string management