MachineKey.Encode(Byte[], MachineKeyProtection) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Varning
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.
Krypterar data och/eller lägger till en hashbaserad kod för meddelandeautentisering (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
Parametrar
- data
- Byte[]
Data som ska krypteras.
- protectionOption
- MachineKeyProtection
Anger om parametern data ska krypteras och/eller hashas.
Returer
Det krypterade värdet, indatavärdet med en tillagd HMAC eller resultatet av kryptering av indatavärdet med en tillagd HMAC.
- Attribut
Exempel
Ett kodexempel finns i klassöversikten MachineKey .
Kommentarer
Information om vilka krypterings- och hashalgoritmer som ASP.NET använder för att dekryptera och verifiera data som skickas finns i machineKey-element (ASP.NET inställningsschema).