HtmlHelper.AntiForgeryToken 方法

定義

多載

AntiForgeryToken()

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。

AntiForgeryToken(String)
已淘汰.

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。 欄位值是使用指定的 Salt 值來產生。

AntiForgeryToken(String, String, String)
已淘汰.

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。 欄位值是使用指定的 Salt 值、網域和路徑來產生。

AntiForgeryToken()

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。

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

傳回

產生的表單欄位 (防偽語彙基元)。

適用於

AntiForgeryToken(String)

警告

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.

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。 欄位值是使用指定的 Salt 值來產生。

[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

參數

salt
String

Salt 值,可以是任何非空白字串。

傳回

產生的表單欄位 (防偽語彙基元)。

屬性

適用於

AntiForgeryToken(String, String, String)

警告

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.

產生隱藏的表單欄位 (防偽語彙基元),表單送出時會驗證這個欄位。 欄位值是使用指定的 Salt 值、網域和路徑來產生。

[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

參數

salt
String

Salt 值,可以是任何非空白字串。

domain
String

應用程式定義域。

path
String

虛擬路徑。

傳回

產生的表單欄位 (防偽語彙基元)。

屬性

適用於