SPHttpApplication.GetVaryByCustomString Method

Provides a means for varying output retrieved from a cache depending on the values of properties of the HttpContext of the current request and the properties of the current Windows SharePoint Services 3.0 application domain.

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

Syntax

'Declaration
Public Overrides NotOverridable Function GetVaryByCustomString ( _
    context As HttpContext, _
    custom As String _
) As String
'Usage
Dim instance As SPHttpApplication
Dim context As HttpContext
Dim custom As String
Dim returnValue As String

returnValue = instance.GetVaryByCustomString(context, _
    custom)
public override sealed string GetVaryByCustomString(
    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 object and the application domain (or properties of one of their children) that are used as the criteria to determine which version of a page or control should be retrieved from a cache (or whether an entirely 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. If they are exactly the same as the corresponding values in a previous request for the same page or control and if the version returned at that time is still in the cache, the cached version is returned to the requestor. Otherwise, a new version is rendered, returned, and cached.

GetVaryByCustomString calls the IVaryByCustomHandler.GetVaryByCustomString method for every IVaryByCustomHandler object that is registered with RegisterGetVaryByCustomStringHandler. Other Windows SharePoint Services 3.0 solution providers may register their own IVaryByCustomHandler objects, so you should not assume that the String returned by GetVaryByCustomString—or, therefore, the caching behavior of the application—is entirely controlled by your solution.

See Also

Reference

SPHttpApplication Class

SPHttpApplication Members

Microsoft.SharePoint.ApplicationRuntime Namespace