共用方式為


OutputCacheProfile.Duration 屬性

定義

取得或設定頁面或控制項快取的時間長度。

public:
 property int Duration { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("duration", DefaultValue=-1)]
public int Duration { get; set; }
[<System.Configuration.ConfigurationProperty("duration", DefaultValue=-1)>]
member this.Duration : int with get, set
Public Property Duration As Integer

屬性值

時間持續時間以秒計。

屬性

範例

以下程式碼範例說明如何使用該 Duration 屬性。


// Get the current Duration.
Int32 durationValue = 
    outputCacheProfile.Duration;

// Set the Duration property to 0.
outputCacheProfile.Duration = 0;
  ' Get the current Duration.
  Dim durationValue As Int32 = _
  outputCacheProfile.Duration

  ' Set the Duration.
outputCacheProfile.Duration = 0

備註

代表 Duration 頁面或使用者控制項快取的時間(秒數)。 設定此屬性會為該頁面或控制項的 HTTP 回應建立一個過期政策,並自動導致其輸出快取。

備註

Duration必須在個人檔案中@ OutputCache或使用該個人檔案的頁面指令中定義。

適用於

另請參閱