Lingua

RequireAntiforgeryTokenAttribute Classe

Definizione

Attributo che può essere usato per indicare se il token antiforgery deve essere convalidato.

[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)]
public class RequireAntiforgeryTokenAttribute : Attribute, Microsoft.AspNetCore.Antiforgery.IAntiforgeryMetadata
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)>]
type RequireAntiforgeryTokenAttribute = class
    inherit Attribute
    interface IAntiforgeryMetadata
Public Class RequireAntiforgeryTokenAttribute
Inherits Attribute
Implements IAntiforgeryMetadata
Ereditarietà
RequireAntiforgeryTokenAttribute
Attributi
Implementazioni

Commenti

La convalida eseguita da UseAntiforgery(IApplicationBuilder) si applica solo alle richieste HTTP POST, PUT e PATCH. Gli endpoint che usano altri metodi HTTP vengono ignorati dal middleware anche quando viene applicato questo attributo.

Se è necessaria la convalida per altri metodi HTTP, risolvere IAntiforgery e chiamare ValidateRequestAsync(HttpContext) o IsRequestValidAsync(HttpContext) nel gestore.

Costruttori

Nome Descrizione
RequireAntiforgeryTokenAttribute(Boolean)

Attributo che può essere usato per indicare se il token antiforgery deve essere convalidato.

Proprietà

Nome Descrizione
RequiresValidation

Ottiene o imposta un valore che indica se il token antiforgery deve essere convalidato.

Si applica a