FormsAuthPasswordFormat 列舉

定義

定義儲存密碼的加密格式。Defines the encryption format for storing passwords.

public enum class FormsAuthPasswordFormat
public enum FormsAuthPasswordFormat
type FormsAuthPasswordFormat = 
Public Enum FormsAuthPasswordFormat
繼承
FormsAuthPasswordFormat

欄位

Clear 0

指定不加密的密碼。Specifies that passwords are not encrypted. 這個欄位是常數。This field is constant.

MD5 2

指定使用 MD5 雜湊演算法加密密碼。Specifies that passwords are encrypted using the MD5 hash algorithm. 這個欄位是常數。This field is constant.

SHA1 1

指定使用 SHA1 雜湊演算法加密密碼。Specifies that passwords are encrypted using the SHA1 hash algorithm. 這個欄位是常數。This field is constant.

SHA256 3

指定使用 SHA256 雜湊演算法加密密碼。Specifies that passwords are encrypted using the SHA256 hash algorithm. 這個欄位是常數。This field is constant.

SHA384 4

指定使用 SHA384 雜湊演算法加密密碼。Specifies that passwords are encrypted using the SHA384 hash algorithm. 這個欄位是常數。This field is constant.

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.

適用於