Partager via


AntiForgery.GetHtml Méthode

Définition

Surcharges

GetHtml()

Ajoute un jeton d'authentification à un formulaire afin d'offrir une protection contre la falsification de requête.

GetHtml(HttpContextBase, String, String, String)
Obsolète.

Ajoute un jeton d'authentification à un formulaire afin d'offrir une protection contre la falsification de requête et permet aux appelants de spécifier les détails sur l'authentification.

GetHtml()

Ajoute un jeton d'authentification à un formulaire afin d'offrir une protection contre la falsification de requête.

public static System.Web.HtmlString GetHtml ();
static member GetHtml : unit -> System.Web.HtmlString
Public Shared Function GetHtml () As HtmlString

Retours

Retourne une chaîne qui contient la valeur de jeton chiffrée dans un champ HTML masqué.

Exceptions

L’objet actuel HttpContext est null.

S’applique à

GetHtml(HttpContextBase, String, String, String)

Attention

This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the <httpCookies> configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.

Ajoute un jeton d'authentification à un formulaire afin d'offrir une protection contre la falsification de requête et permet aux appelants de spécifier les détails sur l'authentification.

[System.Obsolete("This method is deprecated. Use the GetHtml() method instead. To specify a custom domain for the generated cookie, use the <httpCookies> configuration element. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)]
public static System.Web.HtmlString GetHtml (System.Web.HttpContextBase httpContext, string salt, string domain, string path);
static member GetHtml : System.Web.HttpContextBase * string * string * string -> System.Web.HtmlString
Public Shared Function GetHtml (httpContext As HttpContextBase, salt As String, domain As String, path As String) As HtmlString

Paramètres

httpContext
HttpContextBase

Données de contexte HTTP pour une demande.

salt
String

Chaîne facultative de caractères aléatoires (par exemple, Z*7g1&p4) utilisée pour ajouter de la complexité au chiffrement pour plus de sécurité. La valeur par défaut est null.

domain
String

Domaine d'une application Web à partir de laquelle une demande est envoyée.

path
String

Chemin d'accès racine virtuel d'une application Web à partir de laquelle une demande est envoyée.

Retours

Retourne la valeur de jeton chiffrée dans un champ HTML masqué.

Attributs

Exceptions

httpContext a la valeur null.

S’applique à