我在sqlserver实例上维护了aspnetdb.mdf,这是我在ASP.net网站应用程序中使用的角色和成员身份。问题是,当我使用ASP.net网站配置工具添加角色时,这些角色不会在aspnetdb中的aspnet_Roles table中填充。
另一方面,用户和应用程序设置可以很好地分别插入到表aspnet_Users和aspnet_Applications表中吗?我知道我的web.config文件有问题,但不知道什么?
web.config
<configuration>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
<connectionStrings>
<add name="SqlSequrityConnectionString"
connectionString="Data Source=NASEER\SQLEXPRESS;Initial Catalog=aspnetdb;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<authorization>
<allow users="56013" />
</authorization>
<authentication mode="Forms" />
<roleManager enabled="true" />
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<membership defaultProvider="SecurityTutorialsSqlMembershipProvider">
<providers>
<!-- Add a customized SqlMembershipProvider -->
<clear/>
<add name="SecurityTutorialsSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SqlSequrityConnectionString"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="SecurityTutorials"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
</system.web>
</configuration>发布于 2015-04-30 20:19:58
通过添加下面的代码,我使它工作起来.!
<roleManager enabled="true" defaultProvider="SqlRoleManager">
<providers>
<add name="SqlRoleManager"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="SqlSequrityConnectionString"
applicationName="MyApplication" />
</providers>
</roleManager>https://stackoverflow.com/questions/29976352
复制相似问题