OutputCacheLocation 列挙体
アセンブリ: System.Web (system.web.dll 内)

Public Enumeration OutputCacheLocation

メンバ名 | 説明 | |
---|---|---|
Any | 出力キャッシュは、ブラウザ クライアント (要求の送信元)、要求に参加しているプロキシ サーバー (または他の任意のサーバー)、または要求が処理されたサーバーに配置できます。この値は、HttpCacheability.Public 列挙値に対応します。 | |
Client | 出力キャッシュは、要求の送信元のブラウザ クライアントに配置されます。この値は、HttpCacheability.Private 列挙値に対応します。 | |
Downstream | 出力キャッシュは、送信元サーバー以外のすべての HTTP 1.1 キャッシュ対応デバイスに格納できます。これには、プロキシ サーバーおよび要求を出したクライアントも含まれます。 | |
None | 出力キャッシュは、要求されたページに対して無効です。この値は、HttpCacheability.NoCache 列挙値に対応します。 | |
Server | 出力キャッシュは、要求の処理元の Web サーバーに配置されます。この値は、HttpCacheability.Server 列挙値に対応します。 | |
ServerAndClient | 出力キャッシュは、元のサーバーまたは要求側のクライアントにだけ格納されます。プロキシ サーバーは応答をキャッシュすることはできません。この値は、HttpCacheability.Private 列挙値と HttpCacheability.Server 列挙値の組み合わせに対応します。 |

この列挙体によって指定された値は、@ OutputCache ディレクティブを .aspx ファイルに含める場合に使用します。これらの値によって、ページ出力のキャッシュ場所が決定されます。詳細については、「ASP.NET ページのキャッシュ」を参照してください。

Server 値を使用して、要求の処理時にページを Web サーバーにキャッシュする必要があることを指定する方法を次のコード例に示します。
<%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Data" %> ' The following OutputCache directive uses the OutputCacheLocation.Server ' enumeration value to allow output caching only on the origin server. <%@ outputcache duration="10" varybyparam="none" Location="Server" %> <html> <script language="vb" runat="server"> Protected Sub Page_Load(Src As [Object], E As EventArgs) Dim ds As New DataSet() Dim fs As New FileStream(Server.MapPath("schemadata.xml") ,FileMode.Open,FileAccess.Read) Dim reader As New StreamReader(fs) ds.ReadXml(reader) fs.Close() Dim [Source] As New DataView(ds.Tables(0)) MyDataGrid.DataSource = [Source] MyDataGrid.DataBind() TimeMsg.Text = DateTime.Now.ToString("G") End Sub 'Page_Load </script> <body> <h4>Using the OutputCacheLocation Enumeration </h4> <form runat=server> <ASP:DataGrid id="MyDataGrid" runat="server" Width="900" BackColor="#ccccff" BorderColor="black" ShowFooter="false" CellPadding=3 CellSpacing="0" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" EnableViewState="false" /> <i>Page last generated on:</i> <asp:label id="TimeMsg" runat="server" /> </form> </body> </html>
<%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Data" %> // The following OutputCache directive uses the OutputCacheLocation.Server // enumeration value to allow output caching only on the origin server. <%@ outputcache duration="10" varybyparam="none" Location="Server" %> <html> <script language="C#" runat="server"> protected void Page_Load(Object Src, EventArgs E) { DataSet ds = new DataSet(); FileStream fs = new FileStream(Server.MapPath("schemadata.xml") ,FileMode.Open,FileAccess.Read); StreamReader reader = new StreamReader(fs); ds.ReadXml(reader); fs.Close(); DataView Source = new DataView(ds.Tables[0]); // Use the LiteralControl constructor to create a new // instance of the class. LiteralControl myLiteral = new LiteralControl(); // Set the LiteralControl.Text property to an HTML // string and the TableName value of a data source. myLiteral.Text = "<h6><font face=verdana>Caching an XML Table: " + Source.Table.TableName + " </font></h6>"; MyDataGrid.DataSource = Source; MyDataGrid.DataBind(); TimeMsg.Text = DateTime.Now.ToString("G"); } </script> <body> <h6>Using the OutputCacheLocation Enumeration </h6> <form runat=server> <ASP:DataGrid id="MyDataGrid" runat="server" Width="900" BackColor="#ccccff" BorderColor="black" ShowFooter="false" CellPadding=3 CellSpacing="0" Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd" EnableViewState="false" /> <i>Page last generated on:</i> <asp:label id="TimeMsg" runat="server" /> </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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- OutputCacheLocation 列挙体のページへのリンク