OutputCacheProfile.VaryByParam 屬性

定義

取得或設定 VaryByParam 屬性。

public:
 property System::String ^ VaryByParam { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("varyByParam")]
public string VaryByParam { get; set; }
[<System.Configuration.ConfigurationProperty("varyByParam")>]
member this.VaryByParam : string with get, set
Public Property VaryByParam As String

屬性值

VaryByParam 值。

屬性

範例

下列程式碼範例示範如何使用 VaryByParam 屬性。


// Get the current VaryByParam.
String varyByParamValue = 
    outputCacheProfile.VaryByParam;

// Set the VaryByParam.
outputCacheProfile.VaryByParam = 
    string.Empty;
  ' Get the current VaryByParam property.
  Dim varyByParamValue As String = _
  outputCacheProfile.VaryByParam

  ' Set the VaryByParam property.
  outputCacheProfile.VaryByParam = _
  String.Empty

備註

VaryByParam是一組以分號分隔的參數,用來變更快取的輸出。 它允許透過 GET 查詢字串或表單 POST 參數來改變快取的輸出。 例如,您可以藉由指定使用者控制項名稱以及查詢字串或表單 POST 參數,將使用者控制項輸出變更為快取。 如需詳細資訊,請參閱 快取多個版本的使用者控制輸出

設定 VaryByParam 必須定義于使用設定檔的頁面設定檔或 @ OutputCache 指示詞中。

注意

這些 OutputCacheProfile.VaryByParam 設定與@ OutputCache的 屬性所使用的 VaryByParam 設定相同。 不建議設定 「*」 的值,以因所有參數而不同。 這可能會導致 Web 服務器上的快取溢位或拒絕服務攻擊。

適用於

另請參閱