System.Web.Security.ActiveDirectoryMembershipProvider.GeneratePassword Method

Generates a random password.

Syntax

public virtual string GeneratePassword ()

Returns

A random password.

Remarks

The ActiveDirectoryMembershipProvider.GeneratePassword method of the System.Web.Security.ActiveDirectoryMembershipProvider class calls the Membership.GeneratePassword(int, int) method of the System.Web.Security.Membership class to retrieve a random password. The password length is set to the value of the ActiveDirectoryMembershipProvider.MinRequiredPasswordLength property. The password length can never be less than 14.

You can specifically call the Membership.GeneratePassword(int, int) method by referencing the System.Web.Security.ActiveDirectoryMembershipProvider class directly from the Provider property of the System.Web.Security.Membership class.

The generated password only contains alphanumeric characters and the following punctuation marks: !@#$%^&*()_-+=[{]};:<>|./?. No hidden or non-printable control characters are included in the generated password.

The generated password will contain at least the number of non-alphanumeric characters specified in the ActiveDirectoryMembershipProvider.MinRequiredNonAlphanumericCharacters property. The generated password will not be tested with the regular expression in the ActiveDirectoryMembershipProvider.PasswordStrengthRegularExpression property.

Note:

The System.Web.Security.ActiveDirectoryMembershipProvider class does not generate passwords that match complexity requirements set in the directory. It is possible to generate a random password that fails the password complexity rules set by the directory.

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0