This documentation is archived and is not being maintained.

MachineKeySection.CompatibilityMode Property

Gets or sets a value that specifies whether upgraded encryption methods for view state that were introduced in the .NET Framework version 2.0 Service Pack 2 release are used.

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

public function get CompatibilityMode () : MachineKeyCompatibilityMode 
public function set CompatibilityMode (value : MachineKeyCompatibilityMode)

Property Value

Type: System.Web.Configuration.MachineKeyCompatibilityMode
A value that indicates whether encryption methods that were introduced in the .NET Framework 2.0 SP2 are used.

The following values can be specified for the CompatibilityMode property:

  • Framework20SP1. This value specifies that ASP.NET uses encryption methods that were available in versions of ASP.NET earlier than 2.0 SP2. This is the default.

  • Framework20SP2. This value specifies that ASP.NET uses upgraded encryption methods.

  • The upgraded encryption methods in the .NET Framework version 2.0 Service Pack 2 reduce the risk that an attacker can successfully reverse-engineer the DecryptionKey value. The older encryption method is available in order to maintain backward compatibility. This is useful if individual servers in a Web farm have not been upgraded to .NET Framework 2.0 SP2 or later versions. In that case, all servers in a Web farm should have the CompatibilityMode property set to Framework20SP1. If you are working with only one server, or if all servers have been upgraded to the .NET Framework 2.0 SP2 or later versions, set this property to Framework20SP2.


In future releases of the .NET Framework, the upgraded encryption methods will be the default. Setting this property to Framework20SP2 now will make your ASP.NET site more secure and prepare for an easier transition to the next release of the .NET Framework.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1, 3.0 SP2, 2.0 SP2