MachineKeySection.DecryptionKey Property

Gets or sets the key that is used to encrypt and decrypt data, or the process by which the key is generated.

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

<TypeConverterAttribute(GetType(WhiteSpaceTrimStringConverter))> _
Public Property DecryptionKey As String
Dim instance As MachineKeySection
Dim value As String

value = instance.DecryptionKey

instance.DecryptionKey = value
/** @property */
public String get_DecryptionKey ()

/** @property */
public void set_DecryptionKey (String value)

public function get DecryptionKey () : String

public function set DecryptionKey (value : String)

Not applicable.

Property Value

An encryption key value, or a value that indicates how the key is generated. The default is "AutoGenerate,IsolateApps".

The DecryptionKey property is used for encryption and decryption, such as in Windows Forms authentication, and for view state when the Validation property is set to "3DES".

Use the "AutoGenerate" option to specify that ASP.NET generates a random key and stores it in the Local Security Authority. The "AutoGenerate" option is part of the default value.

If you add the IsolateApps modifier to the DecryptionKey value, ASP.NET generates a unique encrypted key for each application by using each application's application ID. IsolateApps is also part of the default value.

If you need to support configuration across a network of Web servers (a Web farm), set the DecryptionKey property manually to ensure consistent configuration.

The following example demonstrates how to use the DecryptionKey property. This code example is part of a larger example provided for the MachineKeySection class.

' Display DecryptionKey property.
Console.WriteLine("DecryptionKey: {0}", configSection.DecryptionKey)

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