FormsAuthPasswordFormat FormsAuthPasswordFormat FormsAuthPasswordFormat FormsAuthPasswordFormat Enum

定义

定义用于存储密码的加密格式。Defines the encryption format for storing passwords.

public enum class FormsAuthPasswordFormat
public enum FormsAuthPasswordFormat
type FormsAuthPasswordFormat = 
Public Enum FormsAuthPasswordFormat
继承
FormsAuthPasswordFormatFormsAuthPasswordFormatFormsAuthPasswordFormatFormsAuthPasswordFormat

字段

Clear Clear Clear Clear 0

指定不对密码进行加密。Specifies that passwords are not encrypted. 此字段为常数。This field is constant.

MD5 MD5 MD5 MD5 2

指定使用 MD5 哈希算法对密码进行加密。Specifies that passwords are encrypted using the MD5 hash algorithm. 此字段为常数。This field is constant.

SHA1 SHA1 SHA1 SHA1 1

指定使用 SHA1 哈希算法对密码进行加密。Specifies that passwords are encrypted using the SHA1 hash algorithm. 此字段为常数。This field is constant.

SHA256 SHA256 SHA256 SHA256 3

指定使用 SHA256 哈希算法对密码进行加密。Specifies that passwords are encrypted using the SHA256 hash algorithm. 此字段为常数。This field is constant.

SHA384 SHA384 SHA384 SHA384 4

指定使用 SHA384 哈希算法对密码进行加密。Specifies that passwords are encrypted using the SHA384 hash algorithm. 此字段为常数。This field is constant.

SHA512 SHA512 SHA512 SHA512 5

指定使用 SHA512 哈希算法对密码进行加密。Specifies that passwords are encrypted using the SHA512 hash algorithm. 此字段为常数。This field is constant.

示例

下面的代码示例演示如何使用FormsAuthPasswordFormat枚举。The following code example shows how to use the FormsAuthPasswordFormat enumeration. 有关如何获取集合的详细说明FormsAuthenticationUserCollection , 请参阅类主题中的代码示例。Refer to the code example in the FormsAuthenticationUserCollection class topic to learn how to get the collection.

// Get the current PasswordFormat property value.
FormsAuthPasswordFormat currentPasswordFormat =
formsAuthenticationCredentials.PasswordFormat;


// Set the PasswordFormat property value.
formsAuthenticationCredentials.PasswordFormat = 
    FormsAuthPasswordFormat.SHA1;

' Get the current PasswordFormat property value.
  Dim currentPasswordFormat _
  As FormsAuthPasswordFormat = _
  formsAuthenticationCredentials.PasswordFormat


' Set the PasswordFormat property value.
  formsAuthenticationCredentials.PasswordFormat = _
  FormsAuthPasswordFormat.SHA1

注解

若要以编程方式配置用于在 Web 应用程序中存储密码的加密类型, AuthenticationSection请使用类。To programmatically configure the type of encryption used to store passwords in a Web application, use the AuthenticationSection class. 此类还可FormsAuthentication在内部使用, 在处理身份验证票证时使用。This class is also used internally by FormsAuthentication in the processing of authentication tickets.

适用于