Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

ControllerBase.ValidateRequest Property

Gets or sets a value that indicates whether request validation is enabled for this request.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)
'Declaration
Public Property ValidateRequest As Boolean 
	Get 
	Set
'Usage
Dim instance As ControllerBase 
Dim value As Boolean 

value = instance.ValidateRequest

instance.ValidateRequest = value

Property Value

Type: System.Boolean
true if request validation is enabled for this request; otherwise, false. The default is true.

In ASP.NET 4, setting the ValidateRequest to false has no effect because validation takes place before the MVC pipeline receives the request. Therefore, in ASP.NET 4 you must set the RequestValidationMode property to a version lower than 4.0. You can configure the validation mode in the Web.config file by using the RequestValidationMode attribute of the httpRuntime element, as shown in the following example:

<system.web>
   <httpRuntime  requestValidationMode="2.0" />
</system.web>

For more information see httpRuntime Element (ASP.NET Settings Schema).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.