Return to HomePage, ASPNET2SecurityFAQs


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

Answer:


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" >
		  <providers>
		    <clear/>
		    <add name="MyCustomMembershipProvider"
		         applicationName="MyAppName"
		         type="CustomMembershipProvider, [CustomDll,] Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
		  </providers>
		 </membership>
	
* 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
		 <authorization> 
		  <deny users="?" />
		 </authorization>
	
* 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 http://msdn.microsoft.com/library/en-us/dnpag2/html/PAGHT000022.asp


Return to
HomePage
ASPNET2SecurityFAQs
Microsoft Communities