ASP.NET “Whidbey” Provider Model

ASP.NET already has many great extensibility points: you can add new HttpModules to interact with an incoming or outgoing request, you can add your own HttpHandler to take over the processing of individual requests, you can extend the configuration system, and finally you can derive from many of our server controls to add your own specific behaviors. In ASP.NET “Whidbey” we’re introducing a new extensiblity point: Providers.

The concept of a provider is something we initially started experimenting with in the ASP.NET Forums. The idea that the data layer of the application, for example all the code specific to SQL Server, would exist in a separate assembly that could be loaded by the running application. This allowed for developers to write their own data layers and simply plug it in (note, this first data layer abstraction concept was from Scott Mitchell). With ASP.NET “Whidbey” we’re taking it to the next level. Many of the new features — Membership, Personalization, Role Manager, Site Navigation, Build Providers, Health Monitoring, etc. — now support a provider model. However, rather than being only a data layer abstraction the provider model in ASP.NET “Whidbey” is both a data and business logic layer abstraction.

What this means to ASP.NET developers is that you can completely unplug the logic/behavior/data interaction of a particular feature of ASP.NET and replace it with your own logic/data layer. A great example is the new Membership system for managing user credentials. Membership provides an easy way for you to validate a user’s credentials:

bool Membership.ValidateUser(username, password);

Internally this call to ValidateUser is being forwarded to a configured provider. For example, the SQL Server Membership provider:

public class MembershipSqlProvider : MembershipProviderBase {

  override public bool ValidateUser (string username, string password) { … }


The provider selection is determined by settings in the web.config (or defaults in the machine.config) file. Both the ASP.NET Forums and Dot Net Nuke projects already implement this new provider model — in case you’d like to see examples of how this system works. Below is sample configuration data from the web.config of the ASP.NET Forums to configure a provider:

<forums defaultProvider=”SqlForumsProvider” defaultLanguage=”en-en” >



      <add name = “SqlForumsProvider” 
           type = “AspNetForums.Data.SqlDataProvider, AspNetForums.SqlDataProvider” 
           connectionString = “[hidden]”
           databaseOwner = “dbo” />

      <add name = “AccessForumsProvider” 
           type = “AspNetForums.Data.AccessDataProvider, AspNetForums.AccessDataProvider” 
           fileLocation = “~\data\AccessDataProvider\AspNetForums.mdb” />



The defaultProvider attribute in the <forums /> element instructs the forums application as to which provider (in the <providers /> section) is the default of the application. The <providers /> section is then used to add (or remove) providers that are available to the application. In the above example, the provider is ‘SqlForumsProvider’ (since we haven’t completed the Access provider yet) and the application then loads and uses this provider for any data interactions.

As you can see, providers are very powerful new feature of ASP.NET. One of the huge wins for everyone is that there is no data model your are locked into. Yes, we’ll provide a great data model for many of our features, but if you’ve already got a data model or use data from other sources — such as an Oracle or DB2 database — you can still easily integrate it with ASP.NET and take advantage of all of the API education we’re putting in place for these features.

In fact, we’re planning on writing some sample providers for both Oracle and DB2 that we’ll post the source code for. If you’d like to learn more about the provider feature, check out the Membership and Role Management or Personalization talks from the PDC. You can access the powerpoints and demos at

P.S., lots of people have been asking where they can get the ASP.NET “Whidbey” alpha from. Unfortunately the Alpha is limited to PDC attendees and MSDN Universal subscribers. If you’re an MSDN Universal Subscriber, you should be able to call an order a copy of the “Whidbey” alpha.