HtmlHelper.AntiForgeryToken HtmlHelper.AntiForgeryToken HtmlHelper.AntiForgeryToken Method

Definition

Overloads

AntiForgeryToken() AntiForgeryToken() AntiForgeryToken()

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted.

AntiForgeryToken(String) AntiForgeryToken(String) AntiForgeryToken(String)

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value.

AntiForgeryToken(String, String, String) AntiForgeryToken(String, String, String) AntiForgeryToken(String, String, String)

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value, domain, and path.

AntiForgeryToken() AntiForgeryToken() AntiForgeryToken()

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted.

public System.Web.Mvc.MvcHtmlString AntiForgeryToken ();
member this.AntiForgeryToken : unit -> System.Web.Mvc.MvcHtmlString
Public Function AntiForgeryToken () As MvcHtmlString
Returns

The generated form field (anti-forgery token).

AntiForgeryToken(String) AntiForgeryToken(String) AntiForgeryToken(String)

Warning

This API is now obsolete.

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value.

[System.Obsolete("This method is deprecated. Use the AntiForgeryToken() method instead. To specify custom data to be embedded within the token, use the static AntiForgeryConfig.AdditionalDataProvider property.", true)]
public System.Web.Mvc.MvcHtmlString AntiForgeryToken (string salt);
member this.AntiForgeryToken : string -> System.Web.Mvc.MvcHtmlString
Public Function AntiForgeryToken (salt As String) As MvcHtmlString
Parameters
salt
String String String

The salt value, which can be any non-empty string.

Returns

The generated form field (anti-forgery token).

AntiForgeryToken(String, String, String) AntiForgeryToken(String, String, String) AntiForgeryToken(String, String, String)

Warning

This API is now obsolete.

Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. The field value is generated using the specified salt value, domain, and path.

[System.Obsolete("This method is deprecated. Use the AntiForgeryToken() 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 System.Web.Mvc.MvcHtmlString AntiForgeryToken (string salt, string domain, string path);
member this.AntiForgeryToken : string * string * string -> System.Web.Mvc.MvcHtmlString
Public Function AntiForgeryToken (salt As String, domain As String, path As String) As MvcHtmlString
Parameters
salt
String String String

The salt value, which can be any non-empty string.

domain
String String String

The application domain.

path
String String String

The virtual path.

Returns

The generated form field (anti-forgery token).

Applies to