| title | IHttpFileInfo::GetVrToken Method |
|---|---|
| description | Learn how the IHttpFileInfo::GetVrToken method returns the virtual token for the corresponding file. |
| ms.date | 10/07/2016 |
| ms.assetid | 7a240fb1-dbff-a43b-418c-fa59d2c67d70 |
Returns the virtual token for the corresponding file.
virtual HANDLE GetVrToken(
VOID
) const = 0; This method takes no parameters.
A HANDLE to the virtual token; otherwise, NULL.
The behavior of the GetVrToken method is implementation specific. You should use the following information as a guideline, but it may not be correct in all scenarios:
-
Implementers that reference an Internet file return a valid
HANDLE. -
Implementers that reference a non-Internet file return NULL.
Caution
Because some implementers return NULL on the GetVrToken method, always test for this condition before using the returned HANDLE.
IHttpFileInfo implementers are responsible for resource management with this data; therefore, IHttpFileInfo implementers must call CloseHandle on the HANDLE when it is no longer needed.
IHttpFileInfo implementers are responsible for resource management with this data; therefore, IHttpFileInfo clients must not call CloseHandle on the returned HANDLE when this data is no longer needed. Furthermore, clients must not change the state of the memory referenced by this HANDLE; otherwise, an access violation will be thrown or the data will become invalid.
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 GetVrToken method to retrieve virtual token information for the requested file and displays this information to a Web client.
[!code-cppIHttpFileInfo#15]
The following text is a sample of the data output from the preceding code example.
HTTP/1.1 200 OK
content-Type:text/plain
Server: Microsoft-IIS/7.0
Date: Thu, 15 Dec 2005 22:22:09 GMT
Content-Length: 17
VR Token: NULL
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.
| 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 |