Freigeben über


OutputCacheProfile.Duration Eigenschaft

Definition

Dient zum Abrufen oder Festlegen der Zeitdauer, während der die Seite oder das Steuerelement zwischengespeichert wird.

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

Eigenschaftswert

Die Zeitdauer in Sekunden.

Attribute

Beispiele

Das folgende Codebeispiel zeigt, wie die Duration Eigenschaft verwendet wird.


// 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

Hinweise

The Duration represents the time in seconds that the page or user control is cached. Durch Festlegen dieser Eigenschaft wird eine Ablaufrichtlinie für HTTP-Antworten von der Seite oder dem Steuerelement festgelegt, auf die sie angewendet wird, und führt automatisch zum Zwischenspeichern ihrer Ausgabe.

Hinweis

Das Duration muss entweder im Profil oder in der @ OutputCache Direktive einer Seite mithilfe des Profils definiert werden.

Gilt für:

Weitere Informationen