forms authentication with sql server 2008 database questions

前端 未结 1 1725
青春惊慌失措
青春惊慌失措 2021-01-20 02:46

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

相关标签:
1条回答
  • 2021-01-20 03:31

    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

    0 讨论(0)
提交回复
热议问题