Substitution.MethodName プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As Substitution Dim value As String value = instance.MethodName instance.MethodName = value
/** @property */ public String get_MethodName () /** @property */ public void set_MethodName (String value)
Substitution コントロールの実行時に呼び出すメソッドの名前を表す文字列。

MethodName プロパティを使用して、Substitution コントロールの実行時に呼び出すコールバック メソッドの名前を指定します。指定するコールバック メソッドは、ページ上または Substitution コントロールを格納しているユーザー コントロールの静的メソッドであることが必要です。コールバック メソッドのシグネチャは、HttpContext パラメータを受け取って文字列を返す HttpResponseSubstitutionCallback デリゲートのシグネチャと一致する必要があります。このコールバック メソッドが返す文字列の内容が、ページ上の Substitution コントロールの位置に表示されます。
HttpContext パラメータは、それぞれの HTTP 要求に関する HTTP 固有のすべての情報をカプセル化します。これを利用して、セッション変数、承認情報、およびパーソナル化の詳細情報にアクセスできます。詳細については、「HttpResponseSubstitutionCallback」を参照してください。

Substitution コントロールを出力キャッシュを使用する Web ページに宣言によって追加する方法のコード例を次に示します。ページが読み込まれると、静的な箇条書きリストがユーザーに表示されます。ページのこのセクションはキャッシュされ、60 秒ごとに更新されます。Substitution コントロールは、実行時に GetUser メソッドを呼び出します。このメソッドは現在のユーザーを表す文字列を返します。この文字列は、ページ上の Substitution コントロールの位置に表示されます。ページのこのセクションはキャッシュされず、ページの表示が更新されるたびに更新されます。
<%@ outputcache duration="60" varybyparam="none" %> <script runat="server" language="VB"> ' The Substitution control calls this method to retrieve ' the name of the current user from the HttpContext object. ' This section of the page is exempt from output caching. Shared Function GetUser(ByVal context As HttpContext) As String Return context.User.Identity.Name End Function </script> <html> <head id="Head1" runat="server"> <title>Substitution.MethodName Property Example</title> </head> <body> <form id="Form1" runat="server"> <h3>Substitution.MethodName Property Example</h3> <!--This section of the page is not cached.--> Welcome to the site, <asp:substitution id="Substitution1" methodname="GetUser" runat="Server"> </asp:substitution> <br /><br /> <!--This section of the page is cached.--> Product list: <asp:bulletedlist id="ItemsBulletedList" displaymode="Text" runat="server"> <asp:ListItem>Product 1</asp:ListItem> <asp:ListItem>Product 2</asp:ListItem> <asp:ListItem>Product 3</asp:ListItem> </asp:bulletedlist> </form> </body> </html>
<%@ outputcache duration="60" varybyparam="none" %> <script runat="server" language="C#"> // The Substitution control calls this method to retrieve // the name of the current user from the HttpContext object. // This section of the page is exempt from output caching. public static string GetUser(HttpContext context) { return context.User.Identity.Name; } </script> <html> <head id="Head1" runat="server"> <title>Substitution.MethodName Property Example</title> </head> <body> <form id="Form1" runat="server"> <h3>Substitution.MethodName Property Example</h3> <!--This section of the page is not cached.--> Welcome to the site, <asp:substitution id="Substitution1" methodname="GetUser" runat="Server"> </asp:substitution> <br /><br /> <!--This section of the page is cached.--> Product list: <asp:bulletedlist id="ItemsBulletedList" displaymode="Text" runat="server"> <asp:ListItem>Product 1</asp:ListItem> <asp:ListItem>Product 2</asp:ListItem> <asp:ListItem>Product 3</asp:ListItem> </asp:bulletedlist> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Substitution クラス
Substitution メンバ
System.Web.UI.WebControls 名前空間
HttpResponseSubstitutionCallback
HttpContext
その他の技術情報
Substitution Web サーバー コントロール
- Substitution.MethodName プロパティのページへのリンク