10 September 2004

C# Password Validation

Posted by Mikhail Esteves under: C#; Tips .

The following function uses a Regular Expression, which you can tweak to just about anything, to check if a password is 8 to 15 in length and contains atleast one digit or symbol.

using System.Text.RegularExpressions;

public bool ValidatePassword(string tPass) { Regex passreg = new Regex("^(?=.*[d$!%^&*()]).{8,15}$”);

Match mRes = passreg.Match(tPass); return mRes.Success; }

Returns true if it matches, false if it doesn’t!



One Comment so far...

IVAN RIOS Says:

15 September 2004 at 11:22 pm.

Quisiera saber como hago para comparar el password que digita el usuario con el que tengo en mi base de datos.

La base de datos que estoy utilizando es MySql y el lenguaje de programacion es C#.

Leave a Reply

Browse

Photography

Projects

Pages

Calendar

September 2004
M T W T F S S
« Aug   Oct »
 12345
6789101112
13141516171819
20212223242526
27282930  

Categories

www.flickr.com

Use OpenDNS