March 8, 2021
Hot Topics:

The ASP.NET 2.0 Provider Model

  • By Dino Esposito
  • Send Email »
  • More Articles »

Moving to ASP.NET 2.0

ASP.NET 2.0 has generalized and transformed the session state module discussed so far into the so-called "ASP.NET provider model," which makes it far more customizable than its predecessor. In particular, several ASP.NET 2.0 features offer rich customization capabilities, including personalization, membership, role management, site map, and of course, session state.

As mentioned, the ASP.NET provider model is an evolution of the ASP.NET 1.x session state managers inspired by the Adapter design pattern. Two key aspects differentiate the ASP.NET 1.x session state model from the ASP.NET 2.0 provider model:

  1. First and foremost, the ASP.NET 2.0 model is based on a richer and more flexible extensibility mechanism.
  2. Secondly, it makes use of base classes instead of interfaces.

The ASP.NET 1.x session state model is based on the mode attribute, which is a closed enumerated type—the SessionStateMode enum. To support a new mode (for example, the Oracle table), you need to extend the enum type and modify the code of the session state module. These changes must be repeated each time you need a new extension.

ASP.NET 2.0's Adapter design pattern offers a better and more flexible code design. An Adapter class implements an interface known to its clients and provides access to an instance of a class not known to its clients. An Adapter object provides an interface's functionality without having to assume which class is being used to implement that interface. The only variation to the Adapter pattern is that a base class is used instead of an interface.

In ASP.NET 2.0, you use the provider model to achieve several tasks, the most important of which are:

  • The implementation of a read/write mechanism to persist the user profile
  • The creation of a user-defined repository of user credentials that supports most common operations, such as verifying the existence of a user, adding and deleting users, and so forth
  • The creation of a user-defined repository for user roles
  • The definition of the site map
  • The introduction of newer types of data storage for the session state

Page 2 of 3

This article was originally published on July 14, 2004

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date