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 服务器上的拒绝服务攻击。

适用于

另请参阅