Export (0) Print
Expand All

HttpRuntimeSection::RequestValidationMode Property

Gets or sets a version number that indicates which ASP.NET version-specific approach to validation will be used.

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

[ConfigurationPropertyAttribute(L"requestValidationMode", DefaultValue = L"4.0")]
public:
property Version^ RequestValidationMode {
	Version^ get ();
	void set (Version^ value);
}

Property Value

Type: System::Version
A value that indicates which ASP.NET version-specific approach to validation will be used. The default is 4.0.

The RequestValidationMode property specifies which ASP.NET approach to validation will be used. This can be the algorithm that is used in versions of ASP.NET earlier than version 4, or the version that is used in .NET Framework 4. The property can be set to the following values:

  • 4.0 (the default). The HttpRequest object internally sets a flag that indicates that request validation should be triggered whenever any HTTP request data is accessed. This guarantees that the request validation is triggered before data such as cookies and URLs are accessed during the request. The request validation settings of the pages element (if any) in the configuration file or of the @ Page directive in an individual page are ignored.

  • 2.0. Request validation is enabled only for pages, not for all HTTP requests. In addition, the request validation settings of the pages element (if any) in the configuration file or of the @ Page directive in an individual page are used to determine which page requests to validate.

The value that you assign to this property is not validated to match a specific version of ASP.NET. Any numeric value smaller than 4.0 (for example, 3.7, 2.9, or 2.0) is interpreted as 2.0. Any number larger than 4.0 is interpreted as 4.0.

To set this value in a configuration file, you can assign a value to the requestValidationMode attribute of the httpRuntime element. For more information, see httpRuntime Element (ASP.NET Settings Schema).

.NET Framework

Supported in: 4.5.2, 4.5.1, 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