HttpApplication.GetVaryByCustomString(HttpContext, String) 方法

定义

提供 VaryByCustom 属性在整个应用程序范围内的实现。

C#
public virtual string GetVaryByCustomString(System.Web.HttpContext context, string custom);

参数

context
HttpContext

一个 HttpContext 对象,包含有关当前 Web 请求的信息。

custom
String

自定义字符串,它指定哪个缓存的响应被用于响应当前请求。

返回

如果 custom 参数的值为 "browser",则为浏览器的 Type;否则为 null

注解

可以重写 GetVaryByCustomString 以添加新方法,用于计算基于当前请求的自定义差值。 实现必须调用它无法识别的自定义值的基类。 有关详细信息,请参阅 如何:使用自定义字符串缓存页面的版本

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

另请参阅