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.

C#
public static void 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

ASP.NET Web Pages 3.2
Product Versions
ASP.NET Web Pages 3.2

Validate(String, String)

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

C#
public static void Validate (string cookieToken, string formToken);

Parameters

cookieToken
String

The cookie token value.

formToken
String

The token form.

Applies to

ASP.NET Web Pages 3.2
Product Versions
ASP.NET Web Pages 3.2

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.

C#
[System.Obsolete("This method is deprecated. Use the Validate() method instead.", true)]
public static void Validate (System.Web.HttpContextBase httpContext, string salt);

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

ASP.NET Web Pages 3.2
Product Versions (Obsolete)
ASP.NET Web Pages (3.2)