SqlMembershipProvider.EnablePasswordReset 属性

定义

获取一个值,指示 SQL Server 成员资格提供程序是否配置为允许用户重置其密码。Gets a value indicating whether the SQL Server membership provider is configured to allow users to reset their passwords.

public:
 virtual property bool EnablePasswordReset { bool get(); };
public override bool EnablePasswordReset { get; }
member this.EnablePasswordReset : bool
Public Overrides ReadOnly Property EnablePasswordReset As Boolean

属性值

如果成员资格提供程序支持密码重置,则为true ;否则为 falsetrue if the membership provider supports password reset; otherwise, false. 默认值为 trueThe default is true.

示例

下面的代码示例演示 ASP.NET 应用程序的 web.config system.web文件的节中的成员身份元素。The following code example shows the membership element in the system.web section of the Web.config file for an ASP.NET application. 它指定应用程序的SqlMembershipProvider实例,并启用密码重置。It specifies the application's SqlMembershipProvider instance and enables password reset.

<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">  
  <providers>  
    <add name="SqlProvider"  
      type="System.Web.Security.SqlMembershipProvider"  
      connectionStringName="SqlServices"  
      enablePasswordRetrieval="false"  
      enablePasswordReset="true"  
      requiresQuestionAndAnswer="true"  
      passwordFormat="Hashed"  
      applicationName="MyApplication" />  
  </providers>  
</membership>  

注解

密码重置允许成员资格提供程序将用户名的当前密码替换为随机生成的新密码。Password reset allows the membership provider to replace the current password for a user name with a new, randomly generated password. PasswordFormat属性设置为Hashed时,此方法特别有用,因为用户无法检索哈希密码值。This is especially useful when the PasswordFormat property is set to Hashed, as users cannot retrieve hashed password values.

适用于

另请参阅