HttpCacheVaryByParams.Item Property

Gets or sets a value indicating whether the cache varies according to the specified HTTP request parameter.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public:
property bool default [String^] {
	bool get (String^ header);
	void set (String^ header, bool value);
}
/** @property */
public boolean get_Item (String header)

/** @property */
public void set_Item (String header, boolean value)

Not applicable.

Parameters

header

The name of the custom parameter.

Property Value

true if the cache should vary by the specified parameter value.

Exception typeCondition

ArgumentNullException

header is a null reference (Nothing in Visual Basic).

When used as an accessor (getter), the Item indexer returns true if a value for the specified parameter is found in the current parameters collection, or if the collection is set to vary by * (an asterisk), which indicates all parameters.

When used as a mutator (setter), the Item indexer sets the value for the parameter in the parameters collection that corresponds to the specified header to true. The value * can be specified, which indicates all parameters.

The following code example demonstrates how the Item indexer is accessed from the HttpCachePolicy object associated with an HttpResponse.

No code example is currently available or this language may not be supported.
get_Response().get_Cache().SetExpires(DateTime.get_Now().
    AddSeconds(60));
get_Response().get_Cache().SetCacheability(HttpCacheability.Public);
get_Response().get_Cache().SetValidUntilExpires(false);
get_Response().get_Cache().get_VaryByParams().
    set_Item("Category", true);

if (get_Response().get_Cache().get_VaryByParams().
    get_Item("Category")) {
    //...
}

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.Cache.SetValidUntilExpires(false)
Response.Cache.VaryByParams("Category") = true

if(Response.Cache.VaryByParams("Category")){
   //...
}
 

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: