MembershipProvider.EncryptPassword 方法

定义

对密码进行加密。Encrypts a password.

重载

EncryptPassword(Byte[])

对密码进行加密。Encrypts a password.

EncryptPassword(Byte[], MembershipPasswordCompatibilityMode)

使用指定的密码兼容性模式对指定密码进行加密。Encrypts the specified password using the specified password-compatibility mode.

注解

此方法返回包含加密密码的字节数组。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()

参数

password
Byte[]

包含要加密的密码的字节数组。A byte array that contains the password to encrypt.

返回

Byte[]

包含已加密的密码的字节数组。A byte array that contains the encrypted password.

异常

ValidationKey 属性或 DecryptionKey 属性设置为 AutoGenerateThe ValidationKey property or DecryptionKey property is set to AutoGenerate.

此方法不可用。This method is not available. 如果应用程序以 .NET Framework 4 Client Profile.NET Framework 4 Client Profile 为目标,则会发生这种情况。This can occur if the application targets the .NET Framework 4 Client Profile.NET Framework 4 Client Profile. 若要避免此异常,请重写该方法,或将应用程序更改为面向 .NET Framework 的完整版本。To prevent this exception, override the method, or change the application to target the full version of the .NET Framework.

示例

有关MembershipProvider实现的示例,请参阅实现配置文件提供程序For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

注解

EncryptPassword方法是一个虚拟方法,为成员资格提供程序实现提供支持加密的密码格式时要使用的方法。The EncryptPassword method is a virtual method that is provided for membership provider implementations to use when supporting encrypted password formats.

另请参阅

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()

参数

password
Byte[]

包含要加密的密码的字节数组。A byte array that contains the password to encrypt.

legacyPasswordCompatibilityMode
MembershipPasswordCompatibilityMode

成员资格密码兼容性模式。The membership password-compatibility mode.

返回

Byte[]

包含已加密的密码的字节数组。A byte array that contains the encrypted password.

异常

ValidationKeyDecryptionKey 属性设置为 AutoGenerateThe ValidationKey property or DecryptionKey property is set to AutoGenerate.

此方法不可用。This method is not available. 如果应用程序以 .NET Framework 4 Client Profile.NET Framework 4 Client Profile 为目标,则会发生这种情况。This can occur if the application targets the .NET Framework 4 Client Profile.NET Framework 4 Client Profile. 若要避免此异常,请重写该方法,或将应用程序更改为面向 .NET Framework 的完整版本。To prevent this exception, override the method, or change the application to target the full version of the .NET Framework.

适用于