This documentation is archived and is not being maintained.
HttpCachePolicy.SetETag Method
.NET Framework 1.1
Sets the ETag HTTP header to the specified string.
[Visual Basic] Public Sub SetETag( _ ByVal etag As String _ ) [C#] public void SetETag( string etag ); [C++] public: void SetETag( String* etag ); [JScript] public function SetETag( etag : String );
Parameters
- etag
- The text to use for the ETag header.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentNullException | etag is a null reference (Nothing in Visual Basic). |
| InvalidOperationException | The ETag header has already been set. |
| InvalidOperationException | SetETagFromFileDependencies has already been called. |
Remarks
The ETag header is a unique identifier for a specific version of a document. Once an ETag header is set, subsequent attempts to set it will fail and an exception will be thrown.
Example
The following example sets the ETag header to a custom value.
[Visual Basic] Response.Cache.SetETag("50f59e42f4d8bc1:cd7") [C#] Response.Cache.SetETag("50f59e42f4d8bc1:cd7"); [C++] Response->Cache->SetETag(S"50f59e42f4d8bc1:cd7"); [JScript] Response.Cache.SetETag("50f59e42f4d8bc1:cd7")
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpCachePolicy Class | HttpCachePolicy Members | System.Web Namespace
Show: