In this article we will be seeing how to configure forms based authentication for claims based web application using SQL provider.
Creating the database:
- Open the Visual Studio 2010 Command Prompt.
- Type aspnet_regsql.
- ASP.NET SQL Server Setup Wizard will pop up.

- Click on Next.

- Click on Next.

- Click on Next.

- Click on Finish.
- A database will be created as shown in the following.

Adding users to the SQL database using Web Site Administration Tool:
- Open Visual Studio 2010.
- Go to File => New => Web Site.
- Select the ASP.NET Empty Web Site template.

- Click Ok.
- Add the following entry in the web.config file.
|
<configuration> <system.web> <membership defaultProvider="AspNetSqlMembershipProvider"> <providers> <clear /> <add name="AspNetSqlMembershipProvider" connectionStringName="AspNetSqlProvider" applicationName="/" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </membership> <roleManager enabled="true"> <providers> <clear /> <add connectionStringName="AspNetSqlProvider" applicationName="/" description="Stores and retrieves roles data from the local Microsoft SQL Server database" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </providers> </roleManager> </system.web> <connectionStrings> <clear/> <add name="AspNetSqlProvider" connectionString="data source=.; Integrated Security=SSPI;Initial Catalog=aspnetdb;" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration> |
- Go to Website =>ASP.Net Configuration.

- Go to Security => Users => Select authentication type.

- Select "From the internet" option and click done.

- Go to Security => Roles => Enable Roles, enter the role name and click "Add Role".

- Go to Security => Users => Create user.

- Create the new user as shown in the following.

- Once you have created the users you could see the users in the SQL database (Databases => aspnetdb =>Tables =>dbo.aspnet_users).

Create a claim based web application:
- Go to Central Administration =>Application Management => Manage web applications.
- In the Contribute group click on New.

- In the Authentication section of the Create New Web Application dialog box, click Claims Based Authentication.

- In the Claims Authentication Types section, select Enable Forms Based Authentication (FBA).
- Type a membership provider name.
- Click OK to create the Web application.

- Create a site collection for the web application SharePoint - 2015.
Configure the web.config files:
- The Central Administration Web application Web.Config file.
- The forms-based authentication claims-based Web application Web.Config file.
- The Security Token Service Web.Config file.










DavidPosted Apr 8, 2011, 12:32 PM
Douglas - I ran into this not long ago along my path to where I am now. Check your logs (event viewer > Windows Logs > Application). Do you see an error like this that is recorded when you attempt to login: "An exception occurred when trying to issue security token." Also check your SharePoint log (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS). David
douglas wattseditedPosted Apr 7, 2011, 8:34 PMEdited Apr 7, 2011, 8:41 PM
When I try to use a user name already added to the SQL 2010 aspnetdb database, I cannot connect using the connection strings settings you provide. Also, when I try to verify the added user I see no accounts in the Forms Auth section. This makes me think that Sharepoint is not able to connect to the SQL database at all. What are your thoughts? Server Error in '/' Application. -------------------------------------------------------------------------------- The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
DavidPosted Apr 7, 2011, 7:22 PM
Fijai, After adding my fbaadmin account to the Security policy for my site (I also made fbaadmin the site's secondary site collection admin) I try to login as fbaadmin but I get "Access Denied". I extended an existing SharePoint Foundation 2010 site that uses Windows authentication; I set up the extended site to use form-based authentication. If you can help me get past this problem then you will be a hero! Thanks, David