This documentation is archived and is not being maintained.

HttpApplication.GetVaryByCustomString Method

Provides an application-wide implementation of the VaryByCustom property.

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

public virtual string GetVaryByCustomString (
	HttpContext context,
	string custom
public String GetVaryByCustomString (
	HttpContext context, 
	String custom
public function GetVaryByCustomString (
	context : HttpContext, 
	custom : String
) : String
Not applicable.



An HttpContext that contains information about the current Web request.


The custom string that specifies which cached response is used to respond to the current request.

Return Value

If the value of custom is "browser", the browser's Type; otherwise, a null reference (Nothing in Visual Basic).

You can override GetVaryByCustomString to add a new method for calculating custom vary-by values based on the current request. The implementation has to call the base class for custom values that it does not recognize. For more information, see How to: Cache Versions of a Page Using Custom Strings.

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