修改asp.net2.0内置成员管理中的强密码规则

错误提示:
密码最短长度为 7,其中必须包含以下非字母数字字符: 1

解决方案:
收到以上的消息主要是在创建用户的时候产生的,对于用Asp.net 网站管理工具的时候创建用户也会产生。
主要是密码输入不符合要求,要改变上面的规定时,主要有两种方法:
1.所有的站点都改变。
     找到machine.config文件

<membership>
            
<providers>
                
<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
="7"
                    minRequiredNonalphanumericCharacters
="1"
                    passwordAttemptWindow
="10"
                    passwordStrengthRegularExpression
="" />
            
</providers>
        
</membership>

里面有两个属性,一个是  minRequiredPasswordLength,意思是最长密码,默认为7另一个是minRequiredNonalphanumericCharacters,默认为1,意思是至少有一个非字母字符,只要把它改成0就可以了。

2.假如只是对某一个站点,只要修改web.config的值就ok了
修改如上,把上面的代码插入在<system.web>下面就ok了。

如要改成密码规则是"至少6个字符,而不用特殊字符的",如下:
(注:一定要加上 <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>

posted @ 2006-07-28 14:51  pensir  阅读(2752)  评论(2编辑  收藏  举报