ControlCachePolicy.SetVaryByCustom Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Sets a list of custom strings that the output cache will use to vary the user control.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public void SetVaryByCustom(
	string varyByCustom


Type: System.String

The list of custom strings.

Exception Condition

The user control is not associated with a BasePartialCachingControl and is not cacheable.

If you pass "browser" as the varyByCustom parameter, the user control will be varied by browser type and major version number. If another custom string is entered, you must override the GetVaryByCustomString method in your application's Global.asax file.

.NET Framework
Available since 2.0
Return to top