HttpResponseSubstitutionCallback デリゲートとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpResponseSubstitutionCallback デリゲートの意味・解説 

HttpResponseSubstitutionCallback デリゲート

メモ : このデリゲートは、.NET Framework version 2.0新しく追加されたものです。

キャッシュ後の置換処理するメソッド表します

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Delegate Function
 HttpResponseSubstitutionCallback ( _
    context As HttpContext _
) As String
Dim instance As New HttpResponseSubstitutionCallback(AddressOf
 HandlerMethod)
public delegate string HttpResponseSubstitutionCallback
 (
    HttpContext context
)
public delegate String^ HttpResponseSubstitutionCallback (
    HttpContext^ context
)
/** @delegate */
public delegate String HttpResponseSubstitutionCallback (
    HttpContext context
)
JScript では、デリゲート使用できますが、新規に宣言することはできません。

パラメータ

context

キャッシュ後置換が必要なコントロールを持つページHTTP 要求情報格納された HttpContext。

戻り値
クライアントへの送信前にキャッシュされた応答挿入されコンテンツ

解説解説
使用例使用例

Substitution コントロールを、出力キャッシュ使用する Web ページプログラムによって追加する方法次のコード例示しますページ読み込まれると、ユーザーに対して現在の日付と時刻ラベル表示されます。ページのこのセクションキャッシュされ、60 秒ごとに更新されます。Substitution コントロールは、実行されると、GetCurrentDateTime メソッド呼び出します。このメソッドシグネチャHttpResponseSubstitutionCallback デリゲートシグネチャ一致する必要がありますGetCurrentDateTime メソッドから返される文字列ユーザー表示されます。ページのこのセクションキャッシュされず、ページ表示更新されるたびに更新されます。Substitution コントロールMethodName プロパティは、コールバック メソッドの名前を取得または設定します

<%@ outputcache duration="60" varybyparam="none"
 %>
<script runat="server" language="VB">
  
  
  Sub Page_Load(ByVal sender As
 Object, ByVal e As System.EventArgs)
    ' Programmatically create a Substitution control.
    Dim Substitution1 As New
 Substitution
    
    ' Specify the callback method.
    Substitution1.MethodName = "GetCurrentDateTime"
    
    ' Add the Substitution control to the controls
    ' collection of PlaceHolder1.
    PlaceHolder1.Controls.Add(Substitution1)
    
    ' Display the current date and time in the label.
    ' Output caching applies to this section of the page.
    CachedDateLabel.Text = DateTime.Now.ToString()
  End Sub
  
  ' The Substitution control calls this method to retrieve
  ' the current date and time. This section of the page
  ' is exempt from output caching. 
  Shared Function GetCurrentDateTime(ByVal
 context As HttpContext) As String
    Return DateTime.Now.ToString()
  End Function
  
</script>

<html>
<head id="Head1" runat="server">
  <title>Substitution Constructor Example</title>
</head>
<body>
  <form id="Form1" runat="server">
  
    <h3>Substitution Constructor Example</h3>  
    
    <p>This section of the page is not
 cached:</p>
    <asp:placeholder id="PlaceHolder1"
      runat="Server">
    </asp:placeholder>
    
    <br />
    
    <p>This section of the page is cached:</p>
    
    <asp:label id="CachedDateLabel"
      runat="Server">
    </asp:label>
    
    <br /><br />
    
    <asp:button id="RefreshButton"
      text="Refresh Page"
      runat="Server">
    </asp:button>     

  </form>
</body>
</html>
<%@ outputcache duration="60" varybyparam="none" %>
<script runat="server" language="C#">  
  
  void Page_Load(object sender, System.EventArgs e)
  {
    // Programmatically create a Substitution control.
    Substitution Substitution1 = new Substitution();
    
    // Specify the callback method.
    Substitution1.MethodName = "GetCurrentDateTime";
    
    // Add the Substitution control to the controls
    // collection of PlaceHolder1.
    PlaceHolder1.Controls.Add (Substitution1);        

    // Display the current date and time in the label.
    // Output caching applies to this section of the page.
    CachedDateLabel.Text = DateTime.Now.ToString();    
  }
  
  // The Substitution control calls this method to retrieve
  // the current date and time. This section of the page
  // is exempt from output caching. 
  public static string GetCurrentDateTime
 (HttpContext context)
  {
    return DateTime.Now.ToString ();
  }
  
</script>

<html>
<head id="Head1" runat="server">
  <title>Substitution Class Example</title>
</head>
<body>
  <form id="Form1" runat="server">
  
    <h3>Substitution Constructor Example</h3>  
    
    <p>This section of the page is not cached:</p>
    <asp:placeholder id="PlaceHolder1"
      runat="Server">
    </asp:placeholder>
    
    <br />
    
    <p>This section of the page is cached:</p>
    
    <asp:label id="CachedDateLabel"
      runat="Server">
    </asp:label>
    
    <br /><br />
    
    <asp:button id="RefreshButton"
      text="Refresh Page"
      runat="Server">
    </asp:button>     

  </form>
</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からHttpResponseSubstitutionCallback デリゲートを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHttpResponseSubstitutionCallback デリゲートを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHttpResponseSubstitutionCallback デリゲート を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HttpResponseSubstitutionCallback デリゲート」の関連用語

HttpResponseSubstitutionCallback デリゲートのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpResponseSubstitutionCallback デリゲートのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS