Wednesday 21 November 2012

Ajax PasswordStrengthExtender Control in Asp.net.


Introduction:
PasswordStrengthExtender control is used to check your password are how much strong. This control is used in website because when user user enter password they can sure that their password is strong.

Code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PaawordStrengthExtender.aspx.cs" Inherits="Ajax_PaawordStrengthExtender" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Password Strength</title>
    <style id="style1" runat="server" type="text/css">
    .poor
    {
        background-color:Blue;
        font-weight:bolder;
    }
    .average
    {
        background-color:Yellow;
        font-weight:bold;
    }
    .verygood
    {
        background-color:Green;
        font-weight:bold;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Label ID="Label1" runat="server" Text="Password"></asp:Label><asp:TextBox ID="TextBox1"
            runat="server" TextMode="Password"></asp:TextBox>
        <cc1:PasswordStrength ID="PasswordStrength1" runat="server" TargetControlID="TextBox1" MinimumLowerCaseCharacters="1" MinimumNumericCharacters="1" MinimumSymbolCharacters="1" MinimumUpperCaseCharacters="1" DisplayPosition="RightSide" PrefixText="Password Strength: " StrengthIndicatorType="Text" RequiresUpperAndLowerCaseCharacters="true" TextStrengthDescriptions="poor;average;good" StrengthStyles="poor;average;verygood">
        </cc1:PasswordStrength>
    </div>
    </form>
</body>
</html>

Run the code and check the output.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.