Membership.MinRequiredNonAlphanumericCharacters 属性

定义

获取有效密码中必须包含的最少特殊字符数。Gets the minimum number of special characters that must be present in a valid password.

public:
 static property int MinRequiredNonAlphanumericCharacters { int get(); };
public static int MinRequiredNonAlphanumericCharacters { get; }
member this.MinRequiredNonAlphanumericCharacters : int
Public Shared ReadOnly Property MinRequiredNonAlphanumericCharacters As Integer

属性值

Int32

有效密码中必须包含的最少特殊字符数。The minimum number of special characters that must be present in a valid password.

示例

下面的代码示例演示应用程序 Web.config 文件的部分中的 成员资格 配置元素 system.webThe following code example shows the membership configuration element in the system.web section of the application's Web.config file. 它指定应用程序使用类的实例 SqlMembershipProvider 来提供成员身份服务,并将 minRequiredNonAlphanumericCharacters 特性设置为1个字符。It specifies that the application use an instance of the SqlMembershipProvider class to provide membership services, and sets the minRequiredNonAlphanumericCharacters attribute to 1 character.

<membership defaultProvider="SqlProvider"  
  userIsOnlineTimeWindow = "20>  
  <providers>  
    <add  
      name="SqlProvider"  
      type="System.Web.Security.SqlMembershipProvider"  
      connectionStringName="SqlServices"  
      requiresQuestionAndAnswer="true"  
      minRequiredNonAlphanumericCharacters="1"  
      />  
  </providers>  
</membership>  

注解

MinRequiredNonAlphanumericCharacters属性返回在为属性中指定的成员资格提供程序创建有效密码时必须输入的特殊非字母数字字符的最小数目 ProviderThe MinRequiredNonAlphanumericCharacters property returns the minimum number of special, non-alphanumeric characters that must be entered to create a valid password for the membership provider specified in the Provider property.

MinRequiredNonAlphanumericCharacters属性值是使用 minRequiredNonAlphanumericCharacters 成员资格配置元素的特性在应用程序配置中设置的。The MinRequiredNonAlphanumericCharacters property value is set in the application configuration using the minRequiredNonAlphanumericCharacters attribute of the membership configuration element.

非字母数字字符是该 IsLetterOrDigit 方法返回的字符 falseA non-alphanumeric character is a character for which the IsLetterOrDigit method returns false.

适用于