OutputCacheLocation 열거형

정의

리소스에 대한 출력 캐시된 HTTP 응답의 위치를 제어하는 데 사용할 유효한 값을 지정합니다.

public enum class OutputCacheLocation
public enum OutputCacheLocation
type OutputCacheLocation = 
Public Enum OutputCacheLocation
상속
OutputCacheLocation

필드

Any 0

출력 캐시의 위치는 요청이 처음 시작된 브라우저 클라이언트, 요청에 참여한 프록시 서버나 기타 서버 또는 요청이 처리된 서버가 될 수 있습니다. 이 값은 Public 열거형 값에 해당합니다.

Client 1

출력 캐시가 요청이 처음 시작된 브라우저 클라이언트에 있습니다. 이 값은 Private 열거형 값에 해당합니다.

Downstream 2

원본 서버 대신 HTTP 1.1 캐시 가능 디바이스에 출력 캐시를 저장할 수 있습니다. 여기에는 요청한 프록시 서버와 클라이언트가 포함됩니다.

None 4

요청된 페이지에서는 출력 캐시를 사용할 수 없습니다. 이 값은 NoCache 열거형 값에 해당합니다.

Server 3

출력 캐시가 요청이 처리된 웹 서버에 있습니다. 이 값은 Server 열거형 값에 해당합니다.

ServerAndClient 5

출력 캐시는 원본 서버 또는 요청 클라이언트에만 저장할 수 있습니다. 프록시 서버는 응답을 캐시할 수 없습니다. 이 값은 PrivateServer 열거형 값의 조합에 해당합니다.

예제

다음 코드 예제에서는 사용 방법을 보여 줍니다 서버 값은 페이지를 웹 서버에서 캐시할지를 지정 하려면 요청이 처리 됩니다.

<%@ 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" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<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>

<head runat="server">
    <title>Using the OutputCacheLocation Enumeration </title>
</head>
<body>

  <h6>Using the OutputCacheLocation Enumeration </h6>
  
  <form id="form1" runat="server">
    <ASP:DataGrid id="MyDataGrid" runat="server"
      Width="900"
      BackColor="#ccccff"
      BorderColor="black"
      ShowFooter="false"
      CellPadding="3"
      CellSpacing="0"
      Font-Names="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" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<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>

<head runat="server">
    <title>Using the OutputCacheLocation Enumeration </title>
</head>
<body>
  <h4>Using the OutputCacheLocation Enumeration </h4>
  
  <form id="form1" runat="server">
    <ASP:DataGrid id="MyDataGrid" runat="server"
      Width="900"
      BackColor="#ccccff"
      BorderColor="black"
      ShowFooter="false"
      CellPadding="3"
      CellSpacing="0"
      Font-Names="Verdana"
      Font-Size="8pt"
      HeaderStyle-BackColor="#aaaadd"
      EnableViewState="false"
    />

    <i>Page last generated on:</i> <asp:label id="TimeMsg" runat="server" />

  </form>
</body>
</html>

설명

이 열거형에 의해 지정 된 값을 포함 하는 경우 사용 되는 @ OutputCache .aspx 파일에서 지시문입니다. 이러한 값 페이지 출력 캐시 위치를 결정합니다. 자세한 내용은 ASP.NET 페이지 캐시합니다.

적용 대상

추가 정보