Just 2 days ago I got to learn log-in controls and forms authentication in ASP .NET.
Before then I used to create my own database my user table and my own logic for log-in and log-out using sessions and sql server.
The new ways is cool as it allows me to do the work fast than before, but what when I use these log-in and create user control a default database ASPNETDB.MDF is saved in App_Data folder.
Since I use my single database for storing everything regarding my site, is it possible to store all the user information in my own database and in my own tables?
I want the power of new controls with the flexibility of my own.
You just have to add a SQL membership provider in your web.config and point it to the right DB, sample extracts below.
<connectionStrings>
<remove name="LocalSqlServer"/>
<clear/>
<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=MYDBNAME;User ID=foo;Password=bar" providerName="System.Data.SqlClient"/>
</connectionStrings>
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider"/>
<add connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="3" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</membership>
Also here a link on how to Create the Membership Schema in SQL Server.