2

我正在尝试制作一个有会员资格的网站。当成员试图更改他的密码问题和答案时,所有作品都会找到 execpt。我发现问题正是在这一行:

bool changeSucceeded = currentUser.ChangePasswordQuestionAndAnswer(model.Password, model.Question, model.Answer);

ChangePasswordQuestionAndAnswer. 我得到了例外:Specified method is not supported.每次我尝试更改问题和答案。我在网上看到了很多东西,但都没有解决我的问题。这是我的 web.config 中的一些重要部分

<add name="ApplicationServices" connectionString="Data Source=localhost;Initial Catalog=ISAACWEBDB;Integrated Security=True" providerName="System.Data.SqlClient"/>

<membership defaultProvider="AspNetSqlMembershipProvider">
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" 
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" 
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>

有谁知道我需要能够做到这一点的错误或缺失的东西是什么?

*编辑:我刚刚看到同样的事情发生了MemberShip.GetAllUsers()

4

1 回答 1

1

MembershipUser.ChangePasswordQuestionAndAnswer的文档给出了失败原因的可能解释:

PlatformNotSupportedException- 此方法不可用。如果应用程序以 .NET Framework 4 客户端配置文件为目标,则可能会发生这种情况。若要防止此异常,请重写该方法,或更改应用程序以面向完整版本的 .NET Framework。

听起来您的目标是项目/解决方案中 .NET Framework 4 的客户端配置文件。

于 2013-05-16T13:41:12.167 回答