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
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기