HttpCachePolicy.SetETag(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the ETag
HTTP header to the specified string.
public:
void SetETag(System::String ^ etag);
public void SetETag (string etag);
member this.SetETag : string -> unit
Public Sub SetETag (etag As String)
Parameters
- etag
- String
The text to use for the ETag
header.
Exceptions
etag
is null
.
The ETag
header has already been set.
-or-
The SetETagFromFileDependencies() has already been called.
Examples
The following code example demonstrates how to set the ETag
header to a custom value.
Response.Cache.SetETag("\"50f59e42f4d8bc1:cd7\"");
Response.Cache.SetETag("""50f59e42f4d8bc1:cd7""")
Remarks
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.
SetETag is introduced in the .NET Framework version 3.5. For more information, see Versions and Dependencies.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應