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
若要指示 HttpCachePolicy 不对其 VaryByHeaders 属性使用 * 值,则为 true;否则为 false。true to direct the HttpCachePolicy to not use the * value for its VaryByHeaders property; otherwise, false.
注解
此方法允许你在 vary:* 缓存的响应随参数变化时防止输出 ached 将标头添加到传出响应。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.
这是一种对属性有影响的便利方法 VaryByHeaders 。This is a convenience method to affect the VaryByHeaders property. 传递 true 给方法会指示 HttpCachePolicy 忽略属性的 * 值 VaryByHeaders 。Passing 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.