Validate strong passwords using RegularExpressionValidator in Asp .Net
In this article we will see how to enforce users to create strong passwords. To validate for strong passwords we will use RegularExpressionValidator with REGEX. For this example we will take three different scenarios:
- Validate strong password which must have 8-10 characters long with at least one numeric character.
- Validate strong password which must have 8-10 characters long with at least one numeric character, one alphabet character and one special character.
- Validate strong password which must have 8-10 characters long with at least one numeric character, one upper case character and one special character.
You may also like my previous validation related posts:
- Remove Blank spaces accuired by validation messages.
- Show Images in error messages.
- Apply Custom CSS to ValidationSummary Control.
Case 1: Validation for 8-10 characters with alphabets,numbers and no special characters.
Output:
Case2: Validation for 8-10 characters with characters,numbers and special characters.
Output:
Case3: Validation for 8-10 characters with characters,numbers,1 upper case letter and special characters.
Output: