Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
FormsProtectionEnum Enumeration
Collapse the table of content
Expand the table of content

FormsProtectionEnum Enumeration

Defines the type of encryption, if any, to use for cookies.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)

public enum FormsProtectionEnum
public enum FormsProtectionEnum
public enum FormsProtectionEnum

 Member nameDescription
AllSpecifies that the application use both data validation and encryption to help protect cookies. This option uses the configured data-validation algorithm (based on the machineKey element). Triple-DES (3DES) is used for encryption, if it is available and if the key is at least 48 bytes long. All is the default (and recommended) value. 
EncryptionSpecifies that cookies are encrypted using Triple-DES or DES, but data validation is not performed on cookies. Cookies used this way might be subject to chosen plaintext security attacks. 
NoneSpecifies that both encryption and validation are disabled for sites that use cookies only for personalization and thus have weaker security requirements. Using cookies in this manner is not recommended; however, it is the least resource-intensive way to enable personalization using the .NET Framework. 
ValidationSpecifies that the application use a validation scheme to verify that the contents of an encrypted cookie have not been altered in transit. The cookie is created by concatenating a validation key with the cookie data, computing a Message Authentication Code (MAC), and appending the MAC to the outgoing cookie. 

If you select the All value, the system uses the configured data-validation algorithm, based on the machineKey Element (ASP.NET Settings Schema) tag. This is the default, and recommended, value.

If you select None, cookies might be subject to plaintext attacks.

If you select Validation, the cookie is created using cookie validation by concatenating a validation key with the cookie data, computing a Message Authentication Code (MAC), and appending the MAC to the outgoing cookie.

The following code example shows how to use the FormsProtectionEnum enumeration. Refer to the code example in the FormsAuthenticationConfiguration class topic to learn how to get the section.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

© 2015 Microsoft