System.Web.Security.FormsAuthentication.Encrypt Method

Creates a string containing an encrypted forms-authentication ticket suitable for use in an HTTP cookie.

Syntax

public static string Encrypt (FormsAuthenticationTicket ticket)

Parameters

ticket
The System.Web.Security.FormsAuthenticationTicket object with which to create the encrypted forms-authentication ticket.

Returns

A string containing an encrypted forms-authentication ticket.

Remarks

The actual method to encrypt the data depends on the setting in the "mode" attribute in the <authentication> section in the <system.web> section of the application configuration.

The possible values are:

ValueEffect
AllChecksums and encrypts the ticket; Prevents tampering and visibility from the user
NoneEncodes the tickets as a hex string, the ticket can be tampered and the content viewed by a client
EncryptionEncrypts the tickets, but does not checksum the results.
ValidationAppends a checksum to the sequence, to avoid a client tampering with the data.

The default mode is "All".

Requirements

Namespace: System.Web.Security
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0