如何在MVC4中使用MySQLRoleProvider?
MySQLProfileProvider和MySQLMembershipProvider工作正常,但Roles.IsUserInRole(“ myRole”)在VS2012 MVC4中不起作用!始终返回Fasle。

<profile defaultProvider="MySQLProfileProvider">
      <providers>
        <remove name="MySQLProfileProvider" />
        <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="\" description="" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" />
      </providers>
    </profile>
    <roleManager defaultProvider="MySQLRoleProvider">
      <providers>
        <remove name="MySQLRoleProvider" />
        <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="\" description="MyRoles description lwt" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" />
      </providers>
    </roleManager>
    <membership defaultProvider="MySQLMembershipProvider">
      <providers>
        <clear />
        <remove name="MySQLMembershipProvider" />
        <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="/" description="MySQL default application" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" enablePasswordRetrieval="False" enablePasswordReset="True" requiresQuestionAndAnswer="True" requiresUniqueEmail="False" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
      </providers>
    </membership>

最佳答案

您并不疯,这是一个已验证的错误:

http://bugs.mysql.com/bug.php?id=75397

这也使我发疯,直到我反编译dll来查看实现。

08-06 21:42