Web Development & Execution
Gerry Shannon
by Gerry Shannon
share this
« Back to the Blog

Microsoft Entity Framework: Using Multiple Membership Providers

Microsoft Entity Framework: Using Multiple Membership Providers

The Membership Framework is used often at Dirigo. We us this framework with many of our websites to set up basic log-in abilities. The fundamental job of a membership provider is to manage the data regarding a site's registered users, and to provide methods for creating users, deleting users, verifying login credentials, changing passwords, and so on. Passwords stored in the membership provider are so secure that even we don't have access to them. This is a good thing because many of those passwords are used elsewhere. No developer, not even Dirigo developers, shoud have access to secure passwords.

We also use the membership provider to set up DirigoEdge log-in permissions. However, with DirigoEdge becoming a more prominent CMS solution for our customers with legacy membership providers, we often encounter membership clashing. The fix takes a bit to figure out. Here is how I deal with the issue.

Multiple membership frameworks can be used on a single website by adding new providers into the Web.config.



<membership defaultProvider="EdgeMembershipProvider">


        <add name="EdgeMembershipProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="EdgeConnection">

        <add name="OtherMembershipProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="OtherConnection">




Notice the Default Provider. The key is the set up of the Connection Strings.

Once your Web.config is set up, then you can switch between providers.



var edge = Membership.Providers["EdgeMembershipProvider"];

edge.ValidateUser(username, password);

var other = Membership.Providers["OtherMembershipProvider"];

other.ValidateUser(username, password);


Since EdgeMembershipProvider is the default provider, then Membership.ValidateUser() is equivalent to edge.ValidateUser(). You can configure as many membership providers as you want in the web.config for your application, but you choose a default provider as part of the setup. If you use the standard Login control, it will only check against that default provider.


Thank you for contacting us!

We'll be in touch!

Back Home ×