共用方式為


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 伺服器上的快取溢位或拒絕服務攻擊。

適用於

另請參閱