Muokkaa

Jaa


RequestValidator.InvokeIsValidRequestString Method

Definition

Provides a public method that calls the protected IsValidRequestString(HttpContext, String, RequestValidationSource, String, Int32) method in order to validate HTTP request data.

public:
 bool InvokeIsValidRequestString(System::Web::HttpContext ^ context, System::String ^ value, System::Web::Util::RequestValidationSource requestValidationSource, System::String ^ collectionKey, [Runtime::InteropServices::Out] int % validationFailureIndex);
public bool InvokeIsValidRequestString (System.Web.HttpContext context, string value, System.Web.Util.RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex);
member this.InvokeIsValidRequestString : System.Web.HttpContext * string * System.Web.Util.RequestValidationSource * string * int -> bool
Public Function InvokeIsValidRequestString (context As HttpContext, value As String, requestValidationSource As RequestValidationSource, collectionKey As String, ByRef validationFailureIndex As Integer) As Boolean

Parameters

context
HttpContext

The HTTP context of the request.

value
String

The HTTP request data to validate.

requestValidationSource
RequestValidationSource

An enumeration that represents the source of request data that is being validated. The following are possible values for the enumeration:

  • QueryString

  • Form

  • Cookies

  • Files

  • Path

  • PathInfo

  • Headers.

collectionKey
String

(Optional) The key in the request collection of the item to validate. This parameter is used if the data to validate is obtained from a collection. If the data to validate is not from a collection, this parameter can be null.

validationFailureIndex
Int32

When this method returns, indicates the zero-based starting point of the problematic or invalid text in the request collection. This parameter is passed uninitialized.

Returns

true if the string to validate does not contain unencoded characters that could be used in a malicious scripting attack; otherwise, false.

Remarks

The InvokeIsValidRequestString method provides public access to the protected IsValidRequestString method. This lets you create a custom wrapper class for the RequestValidator class and call the IsValidRequestString method without having to inherit from the RequestValidator class.

For information about request validation, see UnvalidatedRequestValues.

Applies to