HttpApplication.GetVaryByCustomString(HttpContext, String) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供 VaryByCustom 属性在整个应用程序范围内的实现。
public:
virtual System::String ^ GetVaryByCustomString(System::Web::HttpContext ^ context, System::String ^ custom);
C#
public virtual string GetVaryByCustomString(System.Web.HttpContext context, string custom);
abstract member GetVaryByCustomString : System.Web.HttpContext * string -> string
override this.GetVaryByCustomString : System.Web.HttpContext * string -> string
Public Overridable Function GetVaryByCustomString (context As HttpContext, custom As String) As String
- 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 |