我开发了asp.net MVC 4站点。我已经实现了CustomMembership和CustomRole的东西。 我点击LogOff按钮时收到错误 错误信息: 要调用此方法,“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>
谢谢,