MembershipProvider.EncryptPassword Method

Definition

Encrypts a password.

Overloads

EncryptPassword(Byte[])

Encrypts a password.

EncryptPassword(Byte[], MembershipPasswordCompatibilityMode)

Encrypts the specified password using the specified password-compatibility mode.

Remarks

This method returns a byte array that contains the encrypted password.

EncryptPassword(Byte[])

Encrypts a password.

protected:
 virtual cli::array <System::Byte> ^ EncryptPassword(cli::array <System::Byte> ^ password);
protected virtual byte[] EncryptPassword (byte[] password);
abstract member EncryptPassword : byte[] -> byte[]
override this.EncryptPassword : byte[] -> byte[]
Protected Overridable Function EncryptPassword (password As Byte()) As Byte()

Parameters

password
Byte[]

A byte array that contains the password to encrypt.

Returns

Byte[]

A byte array that contains the encrypted password.

Exceptions

The ValidationKey property or DecryptionKey property is set to AutoGenerate.

This method is not available. This can occur if the application targets the .NET Framework 4 Client Profile. To prevent this exception, override the method, or change the application to target the full version of the .NET Framework.

Examples

For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

Remarks

The EncryptPassword method is a virtual method that is provided for membership provider implementations to use when supporting encrypted password formats.

See also

Applies to

EncryptPassword(Byte[], MembershipPasswordCompatibilityMode)

Encrypts the specified password using the specified password-compatibility mode.

protected:
 virtual cli::array <System::Byte> ^ EncryptPassword(cli::array <System::Byte> ^ password, System::Web::Configuration::MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode);
protected virtual byte[] EncryptPassword (byte[] password, System.Web.Configuration.MembershipPasswordCompatibilityMode legacyPasswordCompatibilityMode);
abstract member EncryptPassword : byte[] * System.Web.Configuration.MembershipPasswordCompatibilityMode -> byte[]
override this.EncryptPassword : byte[] * System.Web.Configuration.MembershipPasswordCompatibilityMode -> byte[]
Protected Overridable Function EncryptPassword (password As Byte(), legacyPasswordCompatibilityMode As MembershipPasswordCompatibilityMode) As Byte()

Parameters

password
Byte[]

A byte array that contains the password to encrypt.

legacyPasswordCompatibilityMode
MembershipPasswordCompatibilityMode

The membership password-compatibility mode.

Returns

Byte[]

A byte array that contains the encrypted password.

Exceptions

The ValidationKey property or DecryptionKey property is set to AutoGenerate.

This method is not available. This can occur if the application targets the .NET Framework 4 Client Profile. To prevent this exception, override the method, or change the application to target the full version of the .NET Framework.

Applies to