<roleManager enabled="true" />
<membership defaultProvider="MyMembershipProvider" hashAlgorithmType="SHA1">
<providers>
<clear/>
<add
name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="LocalSqlServer"
minRequiredPasswordLength="2"
minRequiredNonalphanumericCharacters="0" />
</providers>
</membership>
它给了我一个错误:
第247行: 第248行: 第249行: 第250行:
add name =“AspNetSqlRoleProvider”connectionStringName =“LocalSqlServer”applicationName =“/”type =“System.Web.Security.SqlRoleProvider,System.Web,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a”//这显示为红色。该行位于machine.config文件中
答案 0 :(得分:3)
格式似乎搞砸了。成员资格和角色管理器是两个完全独立的元素,而不是交织在一起:
<membership defaultProvider="MyMembershipProvider" hashAlgorithmType="SHA1">
<providers>
<clear />
<add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="Database" applicationName="/" />
</providers>
</membership>
<roleManager enabled="true">
<providers>
<clear />
<add name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="Database"
applicationName="/" />
</providers>
</roleManager>