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

虚拟路径。

返回

生成的窗体字段(防伪标记)。

属性

适用于