Idioma

RequireAntiforgeryTokenAttribute Classe

Definição

Um atributo que pode ser usado para indicar se o token antiforgery deve ser validado.

[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
Herança
RequireAntiforgeryTokenAttribute
Atributos
Implementações

Comentários

A validação executada apenas UseAntiforgery(IApplicationBuilder) se aplica a solicitações HTTP POST, PUT e PATCH. Os pontos de extremidade que usam outros métodos HTTP são ignorados pelo middleware mesmo quando esse atributo é aplicado.

Se você precisar de validação para outros métodos HTTP, resolva IAntiforgery e chame ValidateRequestAsync(HttpContext) ou IsRequestValidAsync(HttpContext) em seu manipulador.

Construtores

Nome Descrição
RequireAntiforgeryTokenAttribute(Boolean)

Um atributo que pode ser usado para indicar se o token antiforgery deve ser validado.

Propriedades

Nome Descrição
RequiresValidation

Obtém ou define um valor que indica se o token antiforgery deve ser validado.

Aplica-se a