Forms authentication using sql server 2008 database queries

Hello I was trying to figure out how to set up ASP.Net forms authentication using sql database. I am trying to figure out how to set up my authentication on my sql database. So when I update my admin table, it also updates the list of admins in Authenticated Mode.

Any ideas will help you to thank you!

+3


source to share


1 answer


Just run the aspnet_regsql.exe tool and the membership database will be created for you. If you run it without any parameters, it will present you with a wizard to guide you through the process of creating the database.

Here's an example of what you need to add to your Web.Config:

<roleManager enabled="true"/>
<authentication mode="Forms">
    <forms timeout="50000000"/>
</authentication>
<membership defaultProvider="SqlProvider">
    <providers>
    <clear/>
    <add connectionStringName="LocalSqlServer" 
        applicationName="/" 
        enablePasswordRetrieval="false" 
        enablePasswordReset="true" 
        requiresQuestionAndAnswer="false" 
        requiresUniqueEmail="false" 
        passwordFormat="Hashed" 
        minRequiredPasswordLength="6" 
        minRequiredNonalphanumericCharacters="0" 
        name="SqlProvider" 
        type="System.Web.Security.SqlMembershipProvider"/>
    </providers>
</membership>

      



Also note that you can do all the configuration (except the provider) with ASP.NET WAT (Website Administration Tool) using Visual Studio.

Here's a walkthrough of the whole process:

Walkthrough: Create a Membership Website with User Login

+3


source







All Articles