How do I use my custom user / identity store with forms authentication?

From Guidance Share

Jump to: navigation, search

J.D. Meier, Prashant Bansode, Alex Mackman


Implement a custom membership provider inheriting from the MembershipProvider abstract base class. Use this custom provider along with the login controls to implement forms authentication.

The membership feature provides a consistent API for user authentication and user management. The login controls work with membership.

To use a custom user / identify store with forms authentication.

  • Implement a custom membership provider that inherits from the MembershipProvider abstract base class. This custom provider class should interact with your custom user / identity store.
  • Configure the connection string for your provider (if required) in the connectionStrings section
  • Configure the custom provider in your application’s Web.config file and set the defaultProvider as your custom provider as follows
<membership defaultProvider="MyCustomMembershipProvider" >
   <add name="MyCustomMembershipProvider"
        type="CustomMembershipProvider, CustomDll, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  • Configure your application for forms authentication in the Web.Config file as follows
  <authentication mode="Forms">
  • Configure your application to deny access to unauthenticated users in Web.config file as follows
 <deny users="?" />
  • Use the Login and CreateUserWizard controls for creating login page (login.aspx) for forms authentication.

More Information

For more information on using the membership feature, see “How To: Use Membership in ASP.NET 2.0” at

Personal tools