forms authentication with sql server 2008 database questions

╄→尐↘猪︶ㄣ 提交于 2019-12-09 03:38:55

问题


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:


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



来源:https://stackoverflow.com/questions/9901819/forms-authentication-with-sql-server-2008-database-questions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!