HttpCachePolicy.SetOmitVaryStar(Boolean) 方法

定義

指定根據參數變化時,回應是否應包含 vary: 標頭。Specifies whether the response should contain the vary: header when varying by parameters.

public:
 void SetOmitVaryStar(bool omit);
public void SetOmitVaryStar (bool omit);
member this.SetOmitVaryStar : bool -> unit
Public Sub SetOmitVaryStar (omit As Boolean)

參數

omit
Boolean

true 表示讓 HttpCachePolicy 不將 * 值用於其 VaryByHeaders 屬性,否則為 falsetrue to direct the HttpCachePolicy to not use the * value for its VaryByHeaders property; otherwise, false.

備註

當快取的回應因參數而異時,此方法可讓您防止輸出 ached 將 vary:* 標頭新增至傳出回應。This method allows you to prevent the output ached from adding a vary:* header to the outgoing response when the cached response varies by parameter. 這適用于用戶端透過查詢字串進行不同的快取,因為大部分的用戶端會自動因查詢字串而異,而不需要 vary:* 標頭。This is useful for clients varying caching by query string because most clients will automatically vary by query string without requiring the vary:* header.

注意

使用 vary:* 標頭可以停用所有用戶端快取。The use of the vary:* header can disable all client caching.

這是影響屬性的便利方法 VaryByHeadersThis is a convenience method to affect the VaryByHeaders property. 傳遞 true 至方法會指示, HttpCachePolicy 以忽略屬性的 * 值 VaryByHeadersPassing true to the method directs the HttpCachePolicy to ignore the * value for the VaryByHeaders property.

SetOmitVaryStar 在 .NET Framework 版本3.5 中引進。SetOmitVaryStar is introduced in the .NET Framework version 3.5. 如需詳細資訊,請參閱版本和相依性For more information, see Versions and Dependencies.

適用於