RequestValidator.InvokeIsValidRequestString Method (HttpContext, String, RequestValidationSource, String, Int32)

.NET Framework (current version)
 

Provides a public method that calls the protected IsValidRequestString method in order to validate HTTP request data.

Namespace:   System.Web.Util
Assembly:  System.Web (in System.Web.dll)

member InvokeIsValidRequestString : 
        context:HttpContext *
        value:string *
        requestValidationSource:RequestValidationSource *
        collectionKey:string *
        validationFailureIndex:int byref -> bool

Parameters

context
Type: System.Web.HttpContext

The HTTP context of the request.

value
Type: System.String

The HTTP request data to validate.

requestValidationSource
Type: System.Web.Util.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
Type: System.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
Type: System.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.

Return Value

Type: System.Boolean

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

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.

.NET Framework
Available since 4.5
Return to top
Show: