AutoValidateAntiforgeryTokenAttribute Class

Definition

An attribute that causes validation of antiforgery tokens for all unsafe HTTP methods. An antiforgery token is required for HTTP methods other than GET, HEAD, OPTIONS, and TRACE.

C#
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class AutoValidateAntiforgeryTokenAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IFilterFactory, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter
Inheritance
AutoValidateAntiforgeryTokenAttribute
Attributes
Implements

Remarks

AutoValidateAntiforgeryTokenAttribute can be applied as a global filter to trigger validation of antiforgery tokens by default for an application. Use IgnoreAntiforgeryTokenAttribute to suppress validation of the antiforgery token for a controller or action.

Constructors

Properties

IsReusable

Gets a value that indicates if the result of CreateInstance(IServiceProvider) can be reused across requests.

Order

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

Methods

CreateInstance(IServiceProvider)

Creates an instance of the executable filter.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0