Phương pháp này bắt đầu bằng cách đầu tiên xác nhận đối số của nó, và sau đó gọi phương pháp ValidateUser tĩnh. public static void ValidatePassword (string password) { (mật khẩu, đúng, sai, sai, 0, "mật khẩu"); ứng dụng ứng dụng = | Chapter 11 The Client Membership System The ChangePassword Method This is the first of several methods that will be delegating any heavy lifting to the ClientMembershipService class which I will look at later in the chapter. public void ChangePassword string oldPassword string newPassword oldPassword 0 oldPassword newPassword 0 newPassword newPassword oldPassword newPassword This method starts out by first validating its arguments and then calls the static ValidateUser method. public static void ValidatePassword string password password true false false 0 password Application application if throw new ArgumentException Password too short password int count 0 for int i 0 i i if password i count if count throw new ArgumentException Password needs more non alphanumeric chars password if 0 if password throw new ArgumentException Password does not match regular expression password 364 Chapter 11 The Client Membership System if throw new ArgumentException Password too long password I made this method static so I would be able to centralize this logic in the domain in order for it to be reused from a Client Membership Provider. This method does a very exhaustive job of validating the password. It ends up conducting five different tests on the password parameter 1. It first checks to see whether the parameter is null via the Checkparameter method shown previously. 2. The next check is to make sure that the password meets the minimum length requirements of the Client .