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
)
Not applicable.

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 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:
© 2014 Microsoft