共用方式為


快取的 outputCacheSettings 項目 (ASP.NET 設定結構描述)

指定可套用至 ASP.NET 應用程式中之頁面的輸出快取設定檔設定。

<outputCacheSettings>
    <outputCacheProfiles>...</outputCacheProfiles>
</outputCacheSettings>

屬性和項目

下列各節將說明屬性、子項目和父項目。

屬性

無。

子項目

項目

描述

outputCacheProfiles

包含幾組快取設定,這些設定可以套用到要指定 OutputCache 指示詞的頁面中。

父項目

項目

描述

configuration

Common Language Runtime 和 .NET Framework 應用程式所使用之每一個組態檔中的必要根項目。

system.web

針對組態檔中的 ASP.NET 組態設定指定根項目。 包含設定 ASP.NET Web 應用程式和控制該應用程式行為方式的組態項目。

caching

設定 Web 應用程式的快取設定。

備註

預設的組態

下列預設 outputCacheSettings 項目沒有在電腦組態檔或根目錄 Web.config 檔中明確設定,但它卻是 .NET Framework 2.0 版中應用程式所傳回的預設組態。

<outputCacheSettings>
  <outputCacheProfiles>
    <add name = "" 
      enabled = "true" 
      duration = "-1" 
      location = "" 
      sqlDependency = "" 
      varyByCustom = "" 
      varyByControl = "" 
      varyByHeader = "" 
      varyByParam = "" 
      noStore = "false"/>
  </outputCacheProfiles>
</outputCacheSettings>
<outputCacheSettings>
  <outputCacheProfiles>
    <clear />
  </outputCacheProfiles>
</outputCacheSettings>

範例

下列範例只花一分鐘快取伺服器上的頁面,並根據瀏覽器類型和主要版本儲存不同版本的頁面。

<outputCacheSettings>
  <outputCacheProfiles>
    <add name="ServerOnly" 
      duration="60" 
      varyByCustom="browser" 
      location="Server" />
  </outputCacheProfiles>
</outputCacheSettings>

在設計需要以這種方式快取的頁面時,您將需要對頁面加入下列指示詞:

<%@ OutputCache CacheProfile="ServerOnly" %>

如需詳細資訊,請參閱 @ OutputCache

項目資訊

組態區段處理常式

System.Web.Configuration.OutputCacheSettingsSection

組態成員

SystemWebCachingSectionGroup.OutputCacheSettings

可設定的位置

Machine.config

根層次 Web.config

應用程式層級 Web.config

需求

IIS 5.0、5.1 和 6.0

.NET Framework 2.0

Visual Studio 2005

請參閱

工作

逐步解說:使用輸出快取功能增強網站效能

HOW TO:使用位置設定來設定特定的目錄

HOW TO:鎖定 ASP.NET 組態設定

參考

system.web 項目 (ASP.NET 設定結構描述)

configuration 項目 (一般設定結構描述)

caching 項目 (ASP.NET 設定結構描述)

快取之 outputCacheSettings 的 outputCacheProfiles 項目 (ASP.NET 設定結構描述)

System.Configuration

System.Web.Configuration

概念

ASP.NET 快取概觀

ASP.NET 組態檔階層架構和繼承

保護 ASP.NET 組態

ASP.NET 組態案例

其他資源

一般組態設定 (ASP.NET)

ASP.NET 組態設定

ASP.NET 網站管理

ASP.NET 組態檔

ASP.NET 組態 API