| title | IHttpFileInfo::GetVrPath Method |
|---|---|
| description | Describes the IHttpFileInfo::GetVrPath method and details its syntax, parameters, return value, remarks, code example, and requirements. |
| ms.date | 10/07/2016 |
| ms.assetid | ac22a82f-31dc-f432-2fe0-9e816e439d91 |
Returns the virtual path for the corresponding file.
virtual PCWSTR GetVrPath(
VOID
) const = 0; This method takes no parameters.
A pointer to a constant null-terminated Unicode string that contains the virtual path of the corresponding file; otherwise, NULL.
The behavior of the GetVrPath 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 constant null-terminated string.
-
Implementers that reference a non-Internet file return NULL.
Caution
Because some implementers return NULL on the GetVrPath method, always test for this condition before dereferencing the returned pointer.
IHttpFileInfo implementers are responsible for memory management with this data; therefore, IHttpFileInfo implementers that use dynamic memory allocation must release or call delete on the PCWSTR pointer when it is no longer needed.
IHttpFileInfo implementers are responsible for memory management with this data; therefore, IHttpFileInfo clients must not release or call delete on the returned PCWSTR pointer when this data is no longer needed. Furthermore, clients must not cast this data to a pointer that is not a const or change the state of the memory referenced by this PCWSTR; 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 GetVrPath method to retrieve virtual path information for the requested file and displays this information to a Web client.
[!code-cppIHttpFileInfo#14]
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: 16
VR Path: 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 |