Tuesday, 18 June 2013

Password length minimum 7 - Non Alphanumaric is require


In this article I will explain how to solve
Password length minimum: 7. Non-alphanumeric characters required: 1 and how to remove password restrictions, unique email requirement and question and answer options during user registration using


To create user in database we need to enter password like abcd@123 then it will accept otherwise it will throw error like length minimum: 7. Non-alphanumeric characters required: 1 but I got requirement like register user without strong password restrictions and no need to enter unique email and without Question and answer options at that time I tried to remove problem by setting some properties in web.config. Follow below steps to change our application to work according our requirements.

Create one new web application and name it as Registration.aspx now drag and drop the one new control CreateUserWizard from Login Controls list that aspx page like this
<html xmlns="" >

<head runat="server">
<title>Untitled Page</title>
<form id="form1"runat="server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
Now open Web.config file and write the following code

Write the connectionstring like this

<add name="Connection" connectionString="Data Source=.;Integrated Security=true;Initial Catalog=Test" providerName="System.Data.SqlClient"/>
After that write the following code in system.web section

<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="Connection" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" applicationName="SampleApplication"/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="Connection" applicationName="SampleApplication"/>
<roleManager enabled="false">
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="Connection" applicationName="SampleApplication"/>
Here I will explain each option whatever I set in web.config to remove restrictions

By using this property we can remove Question and answer options in CreateUserWizard.
By setting this property no need to enter unique email id we can use same email id for number of accounts.
By setting this property user need to enter at least 6 characters for password.
By setting this property no need to enter any special characters for password.
After that run your application and create user by using CreateUserWizard now it doesn’t show any Question and Answer options and it will accept 6 characters password it won’t show any problem like Password length minimum: 7. Non-alphanumeric characters required: 1.

Before this we need to run the aspnet_regsql.exe this will create the sql server Providers for users more about this msdn.

No comments:

Post a Comment