MachineKey.Encode(Byte[], MachineKeyProtection) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
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 設定架構) 。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應