| Example Description Intelligent password Strength detection provides a very useful and very important feature that prompts the user for the security of the password, as shown in Figure 18.3. Fig. 18.3 key points of cryptographic strength detection technique The Passwordstrength control is a test password strength control provided in the ASP.net AJAX Controls Toolkit version, and when the user enters a password in the Password box, the text box is followed by an explicit password strength hint, which can be indicated in two ways: text and progress bar. The location of the hint information can also be set by the program personnel themselves. In addition, prompt information disappears when the password box loses focus. Table 18.3 is the primary property and description of the Passwordstrength control. Main properties and descriptions of 18.3 passwordstrength controls
Property |
Description |
TargetControlID |
The TextBox control ID to detect the password |
Displayposition |
Location of information for password strength prompts, such as: displayposition= "rightside| leftside| Belowleft " |
Strengthindicatortype |
Intensity information prompt method, including text and progress bar strengthindicatortype= "text| Barindicator " |
Preferredpasswordlength |
Length of password |
Prefixtext |
Text prefixtext= the "Strength:" |
Textcssclass |
CSS style with text square |
Minimumnumericcharacters |
The minimum number of digits to include in the password |
Minimumsymbolcharacters |
The best number of symbols to include in the password (*,#) |
Requiresupperandlowercasecharacters |
Whether you need to match case |
Textstrengthdescriptions |
Text hints when you are writing Textstrengthdescriptions= "very weak, weak, medium, strong, Super strong" |
Barindicatorcssclass |
CSS style for progress bar |
Barbordercssclass |
CSS style for progress bar border |
Helpstatuslabelid |
lable control ID for help hint information |
Calculationweightings |
The proportion of the password composition department, and its value is in the form of "a;b;c;d". Where a represents the length proportion, B represents the proportion of the number, C represents the proportion of the capitalization, D represents the specific proportion of the symbol. A, B, C, D four values and must be 100, the default value is "50;15;15;20" |
implementation Process (1) Create a new AJAX Web site, name it ex08_03, and the default home page is default.aspx. (2) A ScriptManager control, a Passwordstrength control, and a TextBox control are mainly added to the Default.aspx page, where the ScriptManager control is primarily used to manage the Ajax controls on the Web page. The Passwordstrength control implements the password strength hint function, and the TextBox control enters the password text to be validated. (3) Add a progress bar style to the head tag. The code is as follows: <style type= "Text/css" > . bartype { Color:blue; Background-color:green; } . barborder { Border-style:solid; border-width:1px; width:200px; Vertical-align:middle; } . AAA { Background-color: #047AFD; Color: #ffffff; font-family:arial; font-size:9pt; padding:2px 3px 2px 3px; } </style> (4) Set the properties and corresponding values of the Passwordstrength control, with the following code: <cc1:passwordstrength id= "PasswordStrength1" runat= "Server" targetcontrolid= "TextBox1" displayposition= "Rightside" textcssclass= "AAA" helphandleposition= "Belowleft" minimumnumericcharacters= "2" minimumsymbolcharacters= "2" strengthindicatortype= "Barindicator" prefixtext= "Password strength:" preferredpasswordlength= "requiresupperandlowercasecharacters=" "true" Textstrengthdescriptions= "very bad; bad; general; good; calculationweightings=" 40;20;20;20 "barindicatorcssclass=" Bartype " barbordercssclass= "Barborder" > </cc1:passwordstrength> |