0

我开发了 asp.net MVC 4 站点。我已经实现了 CustomMembership 和 CustomRole 的东西。单击注销按钮时出现错误消息: 要调用此方法,“Membership.Provider”属性必须是“ExtendedMembershipProvider”的实例。

这是我的 Web.Config 文件。

<membership defaultProvider="MyMembershipProvider">
  <providers>
    <clear/>
    <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
    <add name="MyMembershipProvider" type="MvcApplicationTest.CustomMembershipProvider"
       connectionStringName="ApplicationServices" 
       enablePasswordRetrieval="false" 
       enablePasswordReset="true"  
       requiresQuestionAndAnswer="false"
       requireUniqueEmail="false"
       maxInvalidPasswordAttempts="5"
       minRequiredPasswordLenth ="6"
       minRequiredNonalphanumericCharacters="0"
       passwordAttemptWindow ="10"
       applicationName ="MvcApplicationTest.Client.Web"
         />
  </providers>
</membership>

<sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>

<roleManager enabled="true" defaultProvider="MyRoleProvider">
  <providers>
    <clear/>
    <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
    <add name="MyRoleProvider" type="MvcApplicationTest.Models.CustomRoleProvider"/>
  </providers>  
</roleManager>

<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
</pages>

谢谢你,

4

0 回答 0