Export (0) Print
Expand All

HttpRequest.ValidateInput Method

Causes validation to occur for the collections accessed through the Cookies, Form, and QueryString properties.

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

public void ValidateInput ()
public void ValidateInput ()
public function ValidateInput ()
Not applicable.

Exception typeCondition

HttpRequestValidationException

Potentially dangerous data was received from the client.

The HttpRequest class uses input validation flags to track whether to perform validation on the request collections accessed through the Cookies, Form, and QueryString properties. The ValidateInput method sets these flags so that when the get accessors for the Cookies, Form, or QueryString property are invoked, input validation is performed. Validation works by checking all input data against a hard-coded list of potentially dangerous data.

If the validation feature is enabled by page directive or configuration, this method is called during the page's ProcessRequest processing phase. The ValidateInput method can be called by your code if the validation feature is not enabled.

TopicLocation
How to: Validate Against Values in a Database for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Range of Values for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Specific Value for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Data Type for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Required Entries for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Display Server Side Custom Validation Messages for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Test Validity Programmatically for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against Patterns for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Programmatically for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Format Validation Error Messages for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate with a Custom Function for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Disable Validation for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against Values in a Database for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Range of Values for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Specific Value for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against a Data Type for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Required Entries for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Display Server Side Custom Validation Messages for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Test Validity Programmatically for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Against Patterns for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate Programmatically for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Format Validation Error Messages for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Validate with a Custom Function for ASP.NET Server ControlsBuilding ASP .NET Web Applications
How to: Disable Validation for ASP.NET Server ControlsBuilding ASP .NET Web Applications

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, 1.1

Community Additions

ADD
Show:
© 2014 Microsoft