Export (0) Print
Expand All

HttpCachePolicy.SetVaryByCustom Method

Specifies a custom text string to vary cached output responses by.

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

public void SetVaryByCustom (
	string custom
)
public void SetVaryByCustom (
	String custom
)
public function SetVaryByCustom (
	custom : String
)

Parameters

custom

The text string to vary cached output by.

Exception typeCondition

ArgumentNullException

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

InvalidOperationException

TheSetVaryByCustom method has already been called.

The following code example demonstrates how to set the custom vary string to "Accept-Charset", which causes the origin-server's cache to choose one of several cached responses depending on the browser's Accept-Charset header.

Response.Cache.SetVaryByCustom("Accept-Charset");
 

get_Response().get_Cache().SetVaryByCustom("Accept-Charset");

Response.Cache.SetVaryByCustom("Accept-Charset")
 

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft