SqlMembershipProvider.RequiresUniqueEmail 属性

定义

获取一个值,指示 SQL Server 成员资格提供程序是否配置为要求每个用户名具有唯一的电子邮件地址。Gets a value indicating whether the SQL Server membership provider is configured to require a unique email address for each user name.

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

属性值

true如果成员资格提供程序要求唯一的电子邮件地址,则为;否则为falsetrue if the membership provider requires a unique email address; otherwise, false. 默认值为 falseThe default is false.

示例

下面的代码示例演示 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 SqlMembershipProvider instance and configures it to require a unique email address for each user name.

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

适用于

另请参阅