How to Implement Form Based authentication in SharePoint 2007 (MOSS/WSS) using AspNetSqlMembershipProvider

There is already a good no. of examples in different blogs showing how to implement FBA in MOSS 2007/WSS 3.0. Here are the steps I followed and found working perfectly for me:

1. Set up a web application and a site collection under it. Do not open the site in Browser yet.

2. Create a new Database in SQL Server

2. Go to Visual Studio Command Prompt and type aspnet_regsql and use the database created in the step above.

3. Using Visual Studio 2005 creates a fresh aspx web App with web.config entry before <system.web> as below ( the dbname should be the same as in step 2):

<connectionStrings>

<remove name="LocalSqlServer" />

<add name="LocalSqlServer" connectionString="Server=<server name>Database=<dbname>;uid=<username>;pwd=<password>;" providerName="System.Data.SqlClient"/>

</connectionStrings>

4. Go to ASP.Net configuration at the top of Solution Explorer and add a user “test” .

5. Change the membership provider for the created SharePoint Web Application created on step 1 above from Central admin> Application Management> Authentication Providers. Change the Authentication Type to “Form” and Membership provider name as AspNetSqlMembershipProvider

6. Add entry in the web.config of the SharePoint Web Application and also in the Central Admin Web App’s web.config (same as in step 3):

<connectionStrings>

<remove name="LocalSqlServer" />

<add name="LocalSqlServer" connectionString="Server=<server name>Database=<dbname>;uid=<username>;pwd=<password>;" providerName="System.Data.SqlClient"/>

</connectionStrings>

7. Change the site collection administrator of the SharePoint Web Application to "test" using Central admin> Application Management>Site Collection Administrators

8. Close central admin Site

9. Open the SharePoint Web Application and you will find the FBA is working.

There is one issue that is associated with Form Based Authentication. You can not find the "MySite" link at the top right corner of the site after you log-in. Here is an article showing how to implement it:

Office SharePoint Server 2007 - Forms Based Authentication (FBA) w/MySites Walk-through - Part 2