Thursday, March 29, 2012

login control validation - how use simple password?

In ASP.NET 2.0, the login control seems to automatically want strong
passwords. How can I allow simple passwords, such as 6 in length with at
least 1 number?
Thanks!In your web.config inside system.web add this:
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider" />
<add connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="2"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
Also, you may need to edit some details according to your database.
notice the options you have for your password strength. use it wisely!
;)
Yossi.
You can set the password regular expression in the membership element of th
e
web.config file. See sample below.
<membership defaultProvider="MyProvider">
<providers>
<add name="MyProvider" connectionStringName="MyDB"
applicationName="MyWebsite" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="false" passwordFormat="Hashed"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordStrengthRegularExpression="^[put your regex here]$"
maxInvalidPasswordAttempts="5" passwordAttemptWindow="5"
type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
There are some other details associated with setting up the provider that
don't come me right now. But this works for me.
Good luck,
Eagle
"VB Programmer" wrote:

> In ASP.NET 2.0, the login control seems to automatically want strong
> passwords. How can I allow simple passwords, such as 6 in length with at
> least 1 number?
> Thanks!
>
>

0 comments:

Post a Comment