Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 3.74 KB

File metadata and controls

52 lines (38 loc) · 3.74 KB
title IHttpFileInfo::GetETag Method
description Learn how the IHttpFileInfo::GetETag method retrieves the entity tag of the corresponding file for an IHttpFileInfo interface.
ms.date 10/07/2016
ms.assetid d2d7360d-8d40-f029-02da-36572b1b8a52

IHttpFileInfo::GetETag Method

Retrieves the entity tag of the corresponding file for an IHttpFileInfo interface.

Syntax

virtual PCSTR GetETag(  
   OUT USHORT* pcchETag = NULL  
) const = 0;  

Parameters

pcchETag
[OUT] A pointer to a USHORT buffer that receives the length, in bytes, of the returned string.

Return Value

A pointer to a string that contains the entity tag.

Remarks

The GetETag method retrieves the entity tag (ETag) for the file that is currently referenced by an IHttpFileInfo interface. You can use the entity tag for file comparisons. For example, you can use the entity tag to determine whether a file that has been cached by a client differs from the version on the server.

Note

For additional information about file comparisons that use the entity tag, see section 13.3.3 in Request for Comments (RFC) 2616, "Hypertext Transfer Protocol -- HTTP/1.1."

After you call the GetETag method, the pcchETag parameter will contain the size, in bytes, of the entity tag that was returned.

Example

The following code example demonstrates how to use the IHttpContext::GetFileInfo method to create an HTTP module that retrieves a pointer to an IHttpFileInfo interface for the current request. The example then calls the GetETag method to retrieve the entity tag for the requested file and displays this information to a Web client.

[!code-cppIHttpFileInfoGetETag#1]

Your module must export the RegisterModule function. You can export this function by creating a module definition (.def) file for your project, or you can compile the module by using the /EXPORT:RegisterModule switch. For more information, see Walkthrough: Creating a Request-Level HTTP Module By Using Native Code.

You can optionally compile the code by using the __stdcall (/Gz) calling convention instead of explicitly declaring the calling convention for each function.

Requirements

Type Description
Client - IIS 7.0 on [!INCLUDEwinvista]
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on [!INCLUDEwinsrv2008]
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- [!INCLUDEiisexp75], [!INCLUDEiisexp80], [!INCLUDEiisexp100]
Header Httpserv.h

See Also

IHttpFileInfo Interface