HttpApplication.GetVaryByCustomString(HttpContext, String) 方法
定义
提供 VaryByCustom 属性在整个应用程序范围内的实现。Provides an application-wide implementation of the VaryByCustom property.
public:
virtual System::String ^ GetVaryByCustomString(System::Web::HttpContext ^ context, System::String ^ custom);
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 请求的信息。An HttpContext object that contains information about the current Web request.
- custom
- String
自定义字符串,它指定哪个缓存的响应被用于响应当前请求。The custom string that specifies which cached response is used to respond to the current request.
返回
如果 custom 参数的值为 "browser",则为浏览器的 Type;否则为 null。If the value of the custom parameter is "browser", the browser's Type; otherwise, null.
注解
您可以重写 GetVaryByCustomString 来添加新的方法,以便根据当前请求计算自定义变化值。You can override GetVaryByCustomString to add a new method for calculating custom vary-by values that are based on the current request. 实现必须调用它无法识别的自定义值的基类。The implementation has to call the base class for custom values that it does not recognize. 有关详细信息,请参阅 如何:使用自定义字符串缓存页面版本。For more information, see How to: Cache Versions of a Page Using Custom Strings.