|
| Recent
Articles |

Retrieve Subdomain From A URL In C# I had to come up with a method that retrieved the subdomain from the current web request on an ASP.NET website. I thought that the System.Uri class contained that information in an easy retrievable way, but no.
Working With Weeks In C# (Not That Obvious) For some reason, Microsoft didn't add a Week property to the DateTime class. I never could figure out why. Instead they gave us the System.Globalization namespace, filled with date related functionality like the different...
Creating Safe Events In C# Whenever you write class libraries, custom control or just about anything else, you probably raise a lot of home made events. That's a simple thing to do, but tedious to write over and over again. That's why I always use...
Assigining a TypeConverter to a Class you Don't Own I ran into problems with the XNA Beta1, where by I had a class that had a Vector2 struct in. The problem with the XNA Vector2 struct is that there is no TypeConverter for it at the moment. This means that there is no support...
Rational Betas Have C++ Goodies Features in the Rational Software Architect v7.0 beta
include improved support for C++, and developers can try out the open beta by pre-registering for it with IBM.
Revisiting C/C++ On Eclipse The tutorial from IBM's developerWorks on using the C/C++ Development Toolkit (CDT) for Eclipse received a refresh over the summer, and it merits a look from those who may have missed it since then.
Using Immediate Window to Work with Values This article is an excerpt from the book: Murach's ASP.NET 2.0 Web Programming with C# 2005. The Immediate window, shown in figure 4-14, is useful for displaying the values of variables or properties that...
|
|
|
12.14.06 Validating Strong Passwords In C# And ASP.NET By
Mads Kristensen It's always a good idea to have a password policy when creating new applications. A password policy can vary from project to project, but the important part is just to have one to begin with.
It is very difficult to implement later in the process and then change all the users' passwords accordingly.
You can do a lot of things to enforce strong passwords, but the most versatile one is probably using regular expressions.
This regular expression will enforce a password to be at least 8 characters, and to be a mix of letters and numbers.
If you want to take it further and force at least one uppercase letter as well, this will do the trick:
Here are some ways to implement this in your own C# or ASP.NET project.
Server-side
Use this simple method to check if a password is strong or not. You can change the regular expression to suit your needs.
Client-side
In ASP.NET you can use the RegularExpressionValidator control to enforce the password policy.
It does not have to be complicated to add a little extra security.
About the Author: Mads Kristensen currently works as a Senior Developer at Traceworks located
in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in
2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and
web services in his daily work as well. A true .NET developer with great passion for the simple solution.
|
|