Share via


MachineKey.Encode(Byte[], MachineKeyProtection) Methode

Definition

Achtung

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.

Verschlüsselt Daten und/oder fügt einen hashbasierten Meldungsauthentifizierungscode (HMAC) an.

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

Parameter

data
Byte[]

Die zu verschlüsselnden Daten.

protectionOption
MachineKeyProtection

Gibt an, ob der data-Parameter verschlüsselt werden soll, und/oder Hash.

Gibt zurück

String

Der verschlüsselte Wert, der Eingabewert mit einem angefügten HMAC oder das Ergebnis der Verschlüsselung des Eingabewerts mit einem angefügten HMAC.

Attribute

Beispiele

Ein Codebeispiel finden Sie in der MachineKey Klassenübersicht.

Hinweise

Informationen dazu, welche Verschlüsselungs- und Hashalgorithmen ASP.NET zum Entschlüsseln und Überprüfen der übergebenen Daten verwendet werden, finden Sie unter machineKey Element (ASP.NET Einstellungen Schema).

Gilt für