HttpCachePolicy.SetETag Method

Sets the ETag HTTP header to the specified string.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public:
void SetETag (
	String^ etag
)
public void SetETag (
	String etag
)
public function SetETag (
	etag : String
)

Parameters

etag

The text to use for the ETag header.

Exception typeCondition

ArgumentNullException

etag is a null reference (Nothing in Visual Basic).

InvalidOperationException

The ETag header has already been set.

- or -

The SetETagFromFileDependencies has already been called.

The ETag header is a unique identifier for a specific version of a document. It is used by clients to validate client-cached content to avoid requesting it again. Once an ETag header is set, subsequent attempts to set it fail and an exception is thrown.

The following code example demonstrates how to set the ETag header to a custom value.

No code example is currently available or this language may not be supported.
get_Response().get_Cache().SetETag("50f59e42f4d8bc1:cd7");

Response.Cache.SetETag("50f59e42f4d8bc1:cd7")
 

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: