Share via


IVaryByCustomHandler.GetVaryByCustomString Method

Varies output retrieved from a cache depending on the values of properties of the HttpContext of the current request and the properties of the current HttpApplication.

Namespace:  Microsoft.SharePoint.ApplicationRuntime
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Function GetVaryByCustomString ( _
    app As HttpApplication, _
    context As HttpContext, _
    custom As String _
) As String
'Usage
Dim instance As IVaryByCustomHandler
Dim app As HttpApplication
Dim context As HttpContext
Dim custom As String
Dim returnValue As String

returnValue = instance.GetVaryByCustomString(app, _
    context, custom)
string GetVaryByCustomString(
    HttpApplication app,
    HttpContext context,
    string custom
)

Parameters

  • custom
    Type: System.String

    The custom string that specifies which cached page or control is used to respond to the current request.

Return Value

Type: System.String
A String that contains one or more values (converted to delimited strings) of properties of the context and app objects (or properties of one of their children) that are used by the cache manager as the criteria to determine which version of a page or control should be retrieved from a cache (or whether a new version should be fetched).

Remarks

Typically, custom is a delimited set of substrings, but it can be a single string.

Typically, each substring in custom is a short, friendly alias for a fully qualified property name.

When a request for a cacheable page or control is received, the cache manager inspects the property values output by GetVaryByCustomString(HttpContext, String). If they are exactly the same as a cached version of the requested page or control, the cached version is returned. Otherwise, a new version is rendered, returned, and cached.

Notes to Implementers

In general, your code should append a value (converted to a string with a delimiter) to the return value for each substring that your code or @ OutputCache directives added to custom before it was passed to IVaryByCustomHandler.GetVaryByCustomString.

Warning

Other Windows SharePoint Services 3.0 solution providers may use their own code and @ OutputCache directives to append their own custom strings to custom, using their own delimiting schemes. Hence, your implementation of IVaryByCustomHandler.GetVaryByCustomString must be written to ignore substrings in custom that are not relevant to your solution.

See Also

Reference

IVaryByCustomHandler Interface

IVaryByCustomHandler Members

Microsoft.SharePoint.ApplicationRuntime Namespace