65.9K
CodeProject is changing. Read more.
Home

Turn off Required Nonalphanumeric Characters in Membership and Roles with ASP.NET 2.0

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.33/5 (5 votes)

Jul 7, 2006

CPOL
viewsIcon

26403

An article on Membership and Roles

Introduction

Quick tutorial on one of the coolest features in ASP.NET 2.0. I have found that if you are using the CreateUserWizard in VS 2005 by default it makes you use the Nonalphanumeric Characters in the password field. Well if your like me this little validator can piss you off in a hurry, so here is the fix for that.

Using the Code

In the Web.config under <roleManager enabled="true"/> put this next snippet in:

<membership defaultProvider="AspNetSqlMembershipProvider" 
    userIsOnlineTimeWindow="15" hashAlgorithmType="">
<providers>
<clear/><CODE> 

<add connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</membership>

I hope this can help someone else out. I have searched all over google.com and have found nothing about turning off the Nonalphanumeric validator.