แก้ไข

แชร์ผ่าน


PagesSection.ValidateRequest Property

Definition

Gets or sets a value that determines whether ASP.NET examines input from the browser for dangerous values. For more information, see Script Exploits Overview.

public:
 property bool ValidateRequest { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("validateRequest", DefaultValue=true)]
public bool ValidateRequest { get; set; }
[<System.Configuration.ConfigurationProperty("validateRequest", DefaultValue=true)>]
member this.ValidateRequest : bool with get, set
Public Property ValidateRequest As Boolean

Property Value

true if ASP.NET examines input from the browser for dangerous values; otherwise, false. The default value is true.

Attributes

Examples

The following code example shows how to use the ValidateRequest property.

// Get the current ValidateRequest property value.
Console.WriteLine(
    "Current ValidateRequest value: '{0}'",
    pagesSection.ValidateRequest);

// Set the ValidateRequest property to true.
pagesSection.ValidateRequest = true;
' Get the current ValidateRequest property value.
Console.WriteLine( _
    "Current ValidateRequest value: '{0}'", _
    pagesSection.ValidateRequest)

' Set the ValidateRequest property to true.
pagesSection.ValidateRequest = True

Remarks

Request validation is performed by comparing all input data to a list of potentially dangerous values. If a match occurs, ASP.NET raises an HttpRequestValidationException.

Applies to

See also