RequireAntiforgeryTokenAttribute Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
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. |