3

Hello I been trying to figure out how to set up ASP.Net forms authentication with sql database I have been trying to figure out how to set up my forms authentication with my sql database. So when I update my admin table it also updates the admin list in the forms authentication.

Any ideas would help thank you!

1 Answer 1

3

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 database creation process.

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 perform all configuration (except the provider) using the ASP.NET WAT (Web Site Administration Tool) from withing Visual Studio.

Here's a walk-through of the entire process:

Walkthrough: Creating a Web Site with Membership and User Login

Sign up to request clarification or add additional context in comments.

4 Comments

thank you however i was wondering how would you add new member in sql database with out using asp.net confi would you do it in ado?
Use the WAT tool icon at the top right of solution explorer in VS :) Then it's GUI driven for this - you can further tweak setting in the secure folder Web.Config file(s) it generates.
thank you! question i have a databse of username and password how would i use the asp.net forms register page to add admin instead of adding each admin one at a time thank you.
Do something like this (though I do not advise it unless you have a lot of admins) forums.asp.net/t/1259172.aspx/1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.