Dela via


ValidateAntiForgeryTokenAttribute Class

Definition

Specifies that the class or method that this attribute is applied validates the anti-forgery token. If the anti-forgery token is not available, or if the token is invalid, the validation will fail and the action method will not execute.

public ref class ValidateAntiForgeryTokenAttribute : Attribute, Microsoft::AspNetCore::Mvc::Filters::IFilterFactory, Microsoft::AspNetCore::Mvc::Filters::IOrderedFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public class ValidateAntiForgeryTokenAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IFilterFactory, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ValidateAntiForgeryTokenAttribute = class
    inherit Attribute
    interface IFilterFactory
    interface IFilterMetadata
    interface IOrderedFilter
Public Class ValidateAntiForgeryTokenAttribute
Inherits Attribute
Implements IFilterFactory, IOrderedFilter
Inheritance
ValidateAntiForgeryTokenAttribute
Attributes
Implements

Remarks

This attribute helps defend against cross-site request forgery. It won't prevent other forgery or tampering attacks.

Constructors

ValidateAntiForgeryTokenAttribute()

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