I have a project that I am working on in ASP.NET MVC 5 but it requires the use of ASP.NET Membership (as opposed to Identity).
I cannot find much material on how to get this done. I ran aspnet_regsql which created all the necessary tables in the database I'm using. And as I'm using DB-first, I updated the model in the MVC application with those tables. So the required tables are there.
What is it that I should do next?
You'll need to determine the required membership provider and configure that in Web.Config.
So assuming we're using MS SQL Server and the SQL Membership Provider you'll need something similar to the following example in the system.web section of Web.Config:
<membership defaultProvider="MembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="MembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SqlConnection"
applicationName="MyApplication"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
minRequiredNonalphanumericCharacters="0" />
</providers>
</membership>
You'll need to make sure that all the settings suit your requirements, specifically you'll want to make sure that you have a connection string declared in Web.Config with the same name as that specified for the connectionStringName attribute. That connection string must have permission to access and point to the database tables you created with aspnet_regsql.
From here it should simply be a case of making use of the Membership classes inside the System.Web.Security namespace. For example, the following code used inside a controller action should fetch the current logged in user:
MembershipUser user = Membership.GetUser();