HttpRequest.ValidateInput HttpRequest.ValidateInput HttpRequest.ValidateInput HttpRequest.ValidateInput Method

定义

对通过 CookiesFormQueryString 属性访问的集合进行验证。Causes validation to occur for the collections accessed through the Cookies, Form, and QueryString properties.

public:
 void ValidateInput();
public void ValidateInput ();
member this.ValidateInput : unit -> unit
Public Sub ValidateInput ()

异常

从客户端接收到具有潜在危险的数据。Potentially dangerous data was received from the client.

注解

类使用输入验证标志来跟踪是否对Cookies通过、 FormQueryString属性访问的请求集合执行验证。 HttpRequestThe HttpRequest class uses input validation flags to track whether to perform validation on the request collections accessed through the Cookies, Form, and QueryString properties. 方法设置这些标志,以便在调用CookiesFormQueryString属性的 get 访问器时,执行输入验证。 ValidateInputThe 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.

如果通过页面指令或配置启用验证功能,则在页面的ProcessRequest处理阶段会调用此方法。If the validation feature is enabled by page directive or configuration, this method is called during the page's ProcessRequest processing phase. 如果ValidateInput未启用验证功能,则您的代码可以调用方法。The ValidateInput method can be called by your code if the validation feature is not enabled.

适用于

另请参阅