This documentation is archived and is not being maintained.
HttpCachePolicy.SetVaryByCustom Method
.NET Framework 1.1
Specifies a custom text string to vary cached output responses by.
[Visual Basic] Public Sub SetVaryByCustom( _ ByVal custom As String _ ) [C#] public void SetVaryByCustom( string custom ); [C++] public: void SetVaryByCustom( String* custom ); [JScript] public function SetVaryByCustom( custom : String );
Parameters
- custom
- The text string to vary cached output by.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | custom is a null reference (Nothing in Visual Basic). |
| InvalidOperationException | SetVaryByCustom has already been set. |
Example
The following example sets the custom vary string to "Accept-Charset" that will cause the origin-server's cache to choose one of several cached responses depending on the browser's Accept-Charset header.
[Visual Basic] Response.Cache.SetVaryByCustom("Accept-Charset") [C#] Response.Cache.SetVaryByCustom("Accept-Charset"); [C++] Response->Cache->SetVaryByCustom(S"Accept-Charset"); [JScript] Response.Cache.SetVaryByCustom("Accept-Charset")
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpCachePolicy Class | HttpCachePolicy Members | System.Web Namespace
Show: