Share via


AntiForgery.Validate Method

Definition

Overloads

Validate()

Validates that input data from an HTML form field comes from the user who submitted the data.

Validate(String, String)

Validates that input data from an HTML form field comes from the user who submitted the data.

Validate(HttpContextBase, String)
Obsolete.

Validates that input data from an HTML form field comes from the user who submitted the data and lets callers specify additional validation details.

Validate()

Validates that input data from an HTML form field comes from the user who submitted the data.

public static void Validate ();
static member Validate : unit -> unit
Public Shared Sub Validate ()

Exceptions

The current HttpContext value is null.

System.Web.Helpers.HttpAntiForgeryException

The HTTP cookie token that accompanies a valid request is missing-or-The form token is missing.-or-The form token value does not match the cookie token value.-or-The form token value does not match the cookie token value.

Applies to

Validate(String, String)

Validates that input data from an HTML form field comes from the user who submitted the data.

public static void Validate (string cookieToken, string formToken);
static member Validate : string * string -> unit
Public Shared Sub Validate (cookieToken As String, formToken As String)

Parameters

cookieToken
String

The cookie token value.

formToken
String

The token form.

Applies to

Validate(HttpContextBase, String)

Caution

This method is deprecated. Use the Validate() method instead.

Validates that input data from an HTML form field comes from the user who submitted the data and lets callers specify additional validation details.

[System.Obsolete("This method is deprecated. Use the Validate() method instead.", true)]
public static void Validate (System.Web.HttpContextBase httpContext, string salt);
static member Validate : System.Web.HttpContextBase * string -> unit
Public Shared Sub Validate (httpContext As HttpContextBase, salt As String)

Parameters

httpContext
HttpContextBase

The HTTP context data for a request.

salt
String

An optional string of random characters (such as Z*7g1&p4) that is used to decrypt an authentication token created by the AntiForgery class. The default is null.

Attributes

Exceptions

The current HttpContext value is null.

System.Web.Helpers.HttpAntiForgeryException

The HTTP cookie token that accompanies a valid request is missing.-or-The form token is missing.-or-The form token value does not match the cookie token value.-or-The form token value does not match the cookie token value.-or-The salt value supplied does not match the salt value that was used to create the form token.

Applies to