HttpCacheValidateHandler Delegate
.NET Framework (current version)
Represents a method that is called to validate a cached item before the item is served from the cache.
Assembly: System.Web (in System.Web.dll)
Public Delegate Sub HttpCacheValidateHandler ( context As HttpContext, data As Object, ByRef validationStatus As HttpValidationStatus )
Parameters
- context
-
Type:
System.Web.HttpContext
The HttpContext object containing information about the current request.
- data
-
Type:
System.Object
User-supplied data used to validate the cached item.
- validationStatus
-
Type:
System.Web.HttpValidationStatus
An HttpValidationStatus enumeration value. Your delegate should set this value to indicate the result of the validation.
If a cached item is invalidated within the scope of the HttpCacheValidateHandler method, it is evicted from the cache and the request for the item is treated as a cache miss.
The following code example demonstrates how to add a new cache validation delegate to an application.
Private Sub Page_Load(sender As Object, e As EventArgs) Response.Cache.AddValidationCallback(New HttpCacheValidateHandler(AddressOf CacheValidate1), Nothing) End Sub Public Sub CacheValidate1(context As HttpContext, data As Object, ByRef status As HttpValidationStatus) If context.Request.QueryString("Valid") = "false" Then status = HttpValidationStatus.Invalid Else status = HttpValidationStatus.Valid End If End Sub
.NET Framework
Available since 1.1
Available since 1.1
Show: