Ajax Asp.Net PasswordStrength Example

PasswordStrength Example Using Ajax In Asp.Net.

In this example i'm explaining how to use PasswordStrength Control Of Ajax Toolkit In Asp.Net With Strength Indicator And BarIndicator.

Passwordstrength ajax asp.net

For this Add latest version of AjaxControlToolkit.dll in BIN folder of application and place one textbox and passwordstrength control on the aspx page.

Add below mentioned CSS style in stylesheet.css for strength bar to show up.



CSS StyleSheet
.BarIndicatorweak
{
    color:Red;
    background-color:Red;
}
.BarIndicatoraverage
{
    color:Blue;
    background-color:Blue;
}
.BarIndicatorgood
{
    color:Green;
    background-color:Green;
}

.BarBorder
{
    border-style:solid;
    border-width:1px;
    padding:2px 2px 2px 2px;
    width:200px;
    vertical-align:middle;
}

Now configure the passwordstrength control as shown below.

<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" 
                          runat="server">
</asp:ToolkitScriptManager>

<asp:TextBox ID="TextBox1" runat="server" 
             TextMode="Password">
</asp:TextBox>
        <br />
<asp:PasswordStrength ID="PasswordStrength1" 
                      runat="server" 
         TargetControlID="TextBox1" 
         RequiresUpperAndLowerCaseCharacters="true"
         MinimumNumericCharacters="1" 
         MinimumSymbolCharacters="1" 
         MinimumUpperCaseCharacters="1" 
         PreferredPasswordLength="8"
         DisplayPosition="RightSide" 
         StrengthIndicatorType="Text">
</asp:PasswordStrength>
        <br />
        <br />
<asp:TextBox ID="TextBox2" runat="server" 
             TextMode="Password">
</asp:TextBox>
<asp:PasswordStrength ID="PasswordStrength2" 
                      runat="server" 
        TargetControlID="TextBox2" 
        RequiresUpperAndLowerCaseCharacters="true"
        MinimumNumericCharacters="1" 
        MinimumSymbolCharacters="1" 
        MinimumUpperCaseCharacters="1" 
        PreferredPasswordLength="8"
        DisplayPosition="RightSide" 
        StrengthIndicatorType="BarIndicator" 
        BarBorderCssClass="BarBorder" 
StrengthStyles="BarIndicatorweak;BarIndicatoraverage;BarIndicatorgood;">
</asp:PasswordStrength>
    </div>
    </form>

Build and run the application.



If you like this post than join us or share

2 comments:

Anonymous said...

Dear Sir
How to use password strength control when script manager is declared in master page


Unknown said...

@Above: Please refer ToolkitScriptManager On MasterPage To Use AjaxControlToolkit Controls to know how to use ajax controls with scriptmanager placed on master page


Find More Articles