MachineKey.Encode(Byte[], MachineKeyProtection) 方法

定義

警告

This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.

加密資料和 (或) 附加雜湊式訊息驗證碼 (HMAC)。

public:
 static System::String ^ Encode(cli::array <System::Byte> ^ data, System::Web::Security::MachineKeyProtection protectionOption);
public static string Encode (byte[] data, System.Web.Security.MachineKeyProtection protectionOption);
[System.Obsolete("This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.")]
public static string Encode (byte[] data, System.Web.Security.MachineKeyProtection protectionOption);
static member Encode : byte[] * System.Web.Security.MachineKeyProtection -> string
[<System.Obsolete("This method is obsolete and is only provided for compatibility with existing code. It is recommended that new code use the Protect and Unprotect methods instead.")>]
static member Encode : byte[] * System.Web.Security.MachineKeyProtection -> string
Public Shared Function Encode (data As Byte(), protectionOption As MachineKeyProtection) As String

參數

data
Byte[]

要加密的資料。

protectionOption
MachineKeyProtection

指示 data 參數是否應該加密和 (或) 雜湊處理。

傳回

加密值、已附加 HMAC 的輸入值,或已附加 HMAC 之輸入值的加密結果。

屬性

範例

如需程式碼範例,請參閱 類別概 MachineKey 觀。

備註

如需 ASP.NET 用來解密和驗證傳入之資料的加密和雜湊演算法相關資訊,請參閱 machineKey 元素 (ASP.NET 設定架構)

適用於