次の方法で共有


AntiForgery.GetHtml メソッド

定義

オーバーロード

GetHtml()

要求の偽造を防止するため、認証トークンをフォームに追加します。

GetHtml(HttpContextBase, String, String, String)
古い.

要求の偽造を防止し、呼び出し元が認証の詳細を指定できるよう、認証トークンをフォームに追加します。

GetHtml()

要求の偽造を防止するため、認証トークンをフォームに追加します。

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

戻り値

隠し HTML フィールドに格納されている暗号化されたトークン値を含む文字列を返します。

例外

現在の HttpContext オブジェクトが null です。

適用対象

GetHtml(HttpContextBase, String, String, String)

注意事項

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.

要求の偽造を防止し、呼び出し元が認証の詳細を指定できるよう、認証トークンをフォームに追加します。

[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

パラメーター

httpContext
HttpContextBase

要求の HTTP コンテキスト データ。

salt
String

安全性を高めるために暗号化に複雑さを加えるために使用されるランダムな文字 (Z*7g1&p4 など) の省略可能な文字列。 既定値は null です。

___domain
String

要求の送信元である Web アプリケーションのドメイン。

path
String

要求の送信元である Web アプリケーションの仮想ルート パス。

戻り値

隠し HTML フィールドに格納されている暗号化されたトークン値を返します。

属性

例外

httpContext が null です。

適用対象