Export (0) Print
Expand All

MachineKeySection.ValidationAlgorithm Property

Gets or sets the name of a custom algorithm that is used to validate forms authentication and view state data.

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

[StringValidatorAttribute(MinLength = )]
[ConfigurationPropertyAttribute("validation", DefaultValue = "HMACSHA256")]
[TypeConverterAttribute(typeof(WhiteSpaceTrimStringConverter))]
public string ValidationAlgorithm { get; set; }

Property Value

Type: System.String
A string that contains the name of a predefined algorithm or the name of a custom algorithm.

The predefined algorithms that are available are defined by the MachineKeyValidation enumeration. If you want to use a custom algorithm, you do not have to set this property. Set the Validation property the to the name of the custom algorithm. When you do that, this property will automatically be set to Custom.

You can set the ValidationAlgorithm property declaratively in the Web.config file or programmatically in code.

To set this property declaratively, you use the validationAlgorithm attribute of the machineKey element in the configuration file. This attribute can be set to the name of a predefined algorithm or of a custom algorithm. The predefined algorithms are defined by the MachineKeyValidation enumeration. Custom algorithms are specified in the validationAlgorithm attribute by using the "alg:" prefix followed by the name of the algorithm. If you use this format to specify a custom algorithm, the Validation property is set to Custom and this property is set to the name that follows the "alg:" prefix.

To set this property programmatically, use the value of one of the predefined algorithms that are defined by the MachineKeyValidation enumeration, or set this property to a custom algorithm name. If you set this property to the name of a custom algorithm, set the Validation property to Custom.

.NET Framework

Supported in: 4.5, 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft