Because of the needs of the project, users who log on to SharePoint application will be taken from a unified platform instead of being retrieved from domain, so they need to authenticate to SharePoint application (claims Authentication Types) To make changes that are more flexible in mixed-mode logons: Windows authentication and Forms Based authentication. Therefore, this blog will focus on the application of SharePoint 2013 custom providers in the form based identity verification (forms-based-authentication).
Change authentication
The first thing you need to know is how to change the authentication of the specified Web application. Enter the SharePoint 2013 Central Administration-àapplication management-àmanage Web applications-àauthentication Providers, As shown below:
As shown in the screenshot, after FBA is enabled, we need to provide custom menbership Provider and role Provider.
Create membership Provider and role Provider
Here I choose to create a class Library, of course you can also directly create a SharePoint 2013 Empty Project, note that either way, the final need to register/install the assembly into the GAC .
If you created SharePoint Project, to install assembly to the GAC, you can deploy directly.
If you are creating a class Library, you need two steps 1. Sign the assembly (right key item-àproperty-àsigning), 2 gacutil/i "<assembly path/assembly name.dll>", as follows (using the VS Command Tool):
Get Strong Name Key File
Install assembly to GAC
For. NET 4.0 ASSEMBLY,GAC is located in the C:\Windows\Microsoft.NET\assembly. NET 3.5 GAC in C:\Windows\assembly, so don't look in the wrong place. Assembly successfully registered to the GAC after the best iisreset.
Next, create the related provider, inherit MembershipProvider and RoleProvider respectively.