asp.net创建用户出现“密码最短长度为7,其中必须包含以下非字母数字字符:1“提示

创建用户时:“密码最短长度为7,其中必须包含以下非字母数字字符: 1”的意思是说,密码至少有7位,且非字母、数字的字符至少必须有一个 如: ~!@#$%^&*()_+    当然这些设置可以修改。

1.   修改machine.config文件(该文件在 C:\WINDOWS\Microsoft.NET\Framework\ v2.0.50727(所安装Framework的版本号)\CONFIG)
找到下面所示文字段:
<membership>
            <providers>
                <add name="AspNetSqlMembershipProvider"
                    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f 7f11d50a3a"
                    connectionStringName="LocalSqlServer"
                    enablePasswordRetrieval="false"
                    enablePasswordReset="true"
                    requiresQuestionAndAnswer="true"
                    applicationName="/"
                    requiresUniqueEmail="false"
                    passwordFormat="Hashed"
                    maxInvalidPasswordAttempts="5"
                    minRequiredPasswordLength="7"
                    minRequiredNonalphanumericCharacters="1"
                     passwordAttemptWindow="10"
                    passwordStrengthRegularExpression="" />
            </providers>
        </membership>里面有两个属性,一个是  minRequiredPasswordLength,意思是最长密码,默认为7.另一个是minRequiredNonalphanumericCharacters,默认为1,意思是至少有一个非字母字符,只要把它改成0就可以了。

2、只是对某一个站点,只要修改web.config
注:一定要加上 <remove name="AspNetSqlMembershipProvider" />项,不然可能会出现如下错误:“ 项“AspNetSqlMembershipProvider”已添加。”错误提示。 

<membership>
            
<providers>
                
<remove name="AspNetSqlMembershipProvider" />
                
<add name="AspNetSqlMembershipProvider"
                    type
="System.Web.Security.SqlMembershipProvider, System.Web, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
"
                    connectionStringName
="LocalSqlServer"
                    enablePasswordRetrieval
="false"
                    enablePasswordReset
="true"
                    requiresQuestionAndAnswer
="true"
                    applicationName
="/"
                    requiresUniqueEmail
="false"
                    passwordFormat
="Hashed"
                    maxInvalidPasswordAttempts
="5"
                    minRequiredPasswordLength
="6"
                    minRequiredNonalphanumericCharacters
="0"
                    passwordAttemptWindow
="10"
                    passwordStrengthRegularExpression
="" />
            
</providers>
   
</membership>
把上面的代码插入在<system.web>节点中。

 

你可能感兴趣的:(asp.net)