形成与SQL Server 2008数据库认证问题

问题描述:

您好,我一直在试图找出如何建立ASP.Net形式与SQL数据库我一直在试图找出如何设置我的窗体身份验证与我的SQL数据库验证。所以,当我更新我的管理表也将更新表单验证管理员列表。

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!

只要运行aspnet_regsql.exe的工具和会员数据库会为您创建。如果不带任何参数运行它,它会present你一个向导来指导您完成数据库创建过程。

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.

下面是你需要添加到你的web.config什么一个例子:

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>

另外请注意,您可以使用 ASP执行所有配置(除了供应商) .NET WAT (网站管理工具)从withing Visual Studio中。

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:

演练:与会员和用户登录创建网站