I created my web application using the Web Form template in VS 2013. It was a quick installation setup where sample pages and the login module were already included.
The login uses the Default connection string which is sourced on the created .mdf file located the App_Data folder. It worked well without extra coding and configuration.
A week later, I decided to change my data source so that I can use my SQL Server membership database. It is not so complicated, just need to know where to do the changes in the application. Below are the steps I did:
1. Change the connection string in the web.config file from
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;
AttachDbFilename=|DataDirectory|\aspnet-MindwebUniversity-20141127075146.mdf;Initial
Catalog=aspnet-MindwebUniversity-20141127075146;Integrated Security=True"
providerName="System.Data.SqlClient" />
to
<add name="ApplicationServices" connectionString="Data Source=Mindweb;Initial Catalog=MindwebUniversity; Persist Security Info=True; User ID=Username;Password=1234" providerName="System.Data.SqlClient"/>
2. Provide values on the Membership, Providers and Role Managers sections
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"/>
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider"/>
</providers>
</roleManager>
3. View the project properties and ensure to change the value in the fields as shown in the image below.