articles

Ajax Toolkit PasswordStrength Control in ASP.Net

Pushpendra Singh9752 01-Dec-2010

The PasswordStrength Extender shows the strength of the password in the TextBox and updates itself as the user types the password. The indicator can display the strength of the password as a text message.

PasswordStrength Properties:

·         TargetControlID - ID of the TextBox to attach to

·         DisplayPosition - Positioning of the strength indicator relative to the target control

·         StrengthIndicatorType - Strength indicator type (Text or BarIndicator)

·         PreferredPasswordLength - Preferred length of the password

·         PrefixText - Text prefixed to the display text when StrengthIndicatorType=Text

·         MinimumNumericCharacters - Minimum number of numeric characters

·         MinimumSymbolCharacters - Minimum number of symbol characters (ex: $ ^ *)

·         RequiresUpperAndLowerCaseCharacters - Specifies whether mixed case characters are required

·         MinimumLowerCaseCharacters - Only in effect if RequiresUpperAndLowerCaseCharacters property is true.

·         MinimumUpperCaseCharacters - Only in effect if RequiresUpperAndLowerCaseCharacters property is true.

·         TextStrengthDescriptions - List of semi-colon separated descriptions used when StrengthIndicatorType=Text (Minimum of 2, maximum of 10; order is weakest to strongest)

·         HelpStatusLabelID - Control ID of the label used to display help text

·         HelpHandlePosition - Positioning of the help handle element relative to the target control

Code:

 <%-- Add the ScriptManager Control and passwordStrength control--%>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
 
<cc1:PasswordStrength ID="PasswordStrength1" runat="server" TargetControlID="TextBox2">
</cc1:PasswordStrength>
 
<asp:Label ID="Label2" runat="server" Text="User Registration" BackColor="AliceBlue" Font-Bold="true"></asp:Label>
<br /><br />
<asp:Label ID="Label1" runat="server" Text="User Name"></asp:Label>
&nbsp<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label3" runat="server" Text="Password"></asp:Label>
&nbsp&nbsp&nbsp
<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
</div>
<p>&nbsp;</p>
<asp:Button ID="Button1" runat="server" Text="Submit" />


Here TargetControlID is "TextBox2" in which PasswordStrength will indicated

Run the project

 

Ajax Toolkit PasswordStrength Control in ASP.Net

When you enter the password in Textbox2 then password strength will show. When you enter less password character then it will show strength poor.

Ajax Toolkit PasswordStrength Control in ASP.Net

Ajax Toolkit PasswordStrength Control in ASP.Net

When you enter more password character than previous then it will show strength good

Ajax Toolkit PasswordStrength Control in ASP.Net

 


Updated 15-Dec-2019

Leave Comment

Comments

Liked By