ARTICLE

PasswordStrength control in AJAX

Posted by Purushottam Rathore Articles | Visual C# January 01, 2009
In this article, I am going to describe how to make strong password using AJAX.
Reader Level:
Download Files:
 

This is a simple task to make your password strong. AjaxToolkit provides passwordStrength control to make strong password. This control is very much useful in the registration process of the websites. Through this control you can force users to supply strong password during registering in your site.

PasswordStrength control hold the following properties:

  • TextCssClass
  • HelpStatusLabelID
  • MinimumNumericCharacters
  • MinimumSymbolCharacters
  • DisplayPosition
  • PreferredPasswordLength
  • RequiresUpperAndLowerCaseCharacters
  • StrengthIndicatorType
  • TargetControlID
  • TextStrengthDescriptions

Follow the given steps:

Step 1: Create new website.

Step 2: Right Click on project's root directory in the solution explorer to add reference (AjaxControlToolkit.dll) like as follow-

Image 1:

Now click on browse tab and select the AjaxControolToolKit.dll from appropiate place like as follows.

 

Image 2:

Step 3: Now Use the PasswordStrength control like this.

<ajaxToolkit:PasswordStrength ID="PasswordStrength2" runat="server" TextCssClass="TextIndicator_TextBox1" HelpStatusLabelID="Label1" MinimumNumericCharacters="1" MinimumSymbolCharacters="1" DisplayPosition="RightSide" PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" StrengthIndicatorType="Text" TargetControlID="TextBox1" TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent">
</ajaxToolkit:PasswordStrength>

Example:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <
head runat="server">
        <title>Password Strength</title>
    </
head>
<
body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
        <asp:Panel ID="Panel1" runat="server" BackColor="#cccc66" Height="100px" Width="500px"><br />&nbsp;

            <asp:Label ID="LabelName" runat="server" Text="Enter Password" Font-Bold="true"></asp:Label>

            <asp:TextBox ID="TextBox1" runat="server" Width="204px" BorderColor="#400000" Font-Names="Times New Roman" ForeColor="#400040"></asp:TextBox><br />&nbsp;

            <asp:Label ID="Label1" runat="server" Width="204px" ForeColor="red"></asp:Label><br /><br />

            <ajaxToolkit:PasswordStrength ID="PasswordStrength2" runat="server" TextCssClass="TextIndicator_TextBox1" HelpStatusLabelID="Label1" MinimumNumericCharacters="1" MinimumSymbolCharacters="1" DisplayPosition="RightSide" PreferredPasswordLength="6" RequiresUpperAndLowerCaseCharacters="True" StrengthIndicatorType="Text" TargetControlID="TextBox1" TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent">
           
</ajaxToolkit:PasswordStrength>
        </asp:Panel>
    </div>
</form>
</
body>
</
html>



Image 3:

OutPut: When I enter single character then following message occur

Image 4:

When I enter characters, SpecialCharacter then following message occur.

Image 5:

When I enter characters, SpecialCharacter, and number then following message occur.

Image 6:

Login to add your contents and source code to this article
post comment
     

its a cool tut

but a have  problem with add reference 

http://www.pibl.net/up/uploads/12868104421.jpg
Where i can fine the DLL file

Posted by saad saad Oct 11, 2010


hi steen...

AjaxToolkit:PasswordStrength contain the following properties:

  • PreferredPasswordLength
  • MinimumNumericCharacters
  • MinimumSymbolCharacters etc.

Here I have used PreferredPasswordLength for more characters, MinimumNumericCharacters for NumericCharacters and MinimumSymbolCharacters for symbols.

Posted by Purushottam Rathore Jan 19, 2009

Perfect, but ... How can I change the language on some of the text. I have found out to change TextStrengthDescriptions and PrefixText, but where can I change "# more characters", "# more numbers", "Mixed case characters" and "# symbol characters"

Posted by Steen Alcor Jan 19, 2009

thanks...

Posted by Purushottam Rathore Jan 15, 2009

cool...

Posted by jay sawant Jan 14, 2009
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts