| title | IHttpFileInfo::GetModuleContextContainer Method |
|---|---|
| description | IHttpFileInfo::GetModuleContextContainer Method returns an IHttpModuleContextContainer pointer for the corresponding file. |
| ms.date | 10/07/2016 |
| ms.assetid | 4a2a126b-279e-3424-ec98-2c8022343a9c |
Returns an IHttpModuleContextContainer pointer for the corresponding file.
virtual IHttpModuleContextContainer* GetModuleContextContainer(
VOID
) = 0; This method takes no parameters.
A pointer to an IHttpModuleContextContainer interface.
The GetModuleContextContainer method return value depends on implementation. By default, the current implementation creates an IDispensedHttpModuleContextContainer that is synchronized but not dispensed.
IHttpFileInfo implementers are responsible for memory management with this data; therefore, IHttpFileInfo implementers should create an IDispensedHttpModuleContextContainer pointer at construction and hold a private reference to this IDispensedHttpModuleContextContainer pointer for the life of the IHttpFileInfo pointer. When the GetModuleContextContainer method is called, you should upcast and return this same IDispensedHttpModuleContextContainer pointer. When the destructor of the class that implements the IHttpFileInfo interface is called, this destructor should call the IDispensedHttpModuleContextContainer::ReleaseContainer method on this private reference and then set that reference to NULL.
GetModuleContextContainer should not return NULL. If the internal container is NULL, set this internal container to the value on the call to IHttpServer::DispenseContainer, and then return this same container.
Note
Although implicit upcast operations are considered safe, consider using an explicit cast for program clarity. Also consider using the dynamic_cast operator whenever possible.
IHttpFileInfo implementers are responsible for memory management with this data; therefore, IHttpFileInfo clients must not release, call delete on, or attempt to downcast and call IDispensedHttpModuleContextContainer::ReleaseContainer on the returned IHttpModuleContextContainer pointer when this data is no longer needed.
The following code example demonstrates a custom class named MyContainer that implements the IDispensedHttpModuleContextContainer interface, and a custom class named MyClass that implements the IHttpFileInfo interface. MyClass manages a MyContainer pointer during the lifetime of a MyClass pointer.
[!code-cppIHttpFileInfo#12]
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 |
IHttpFileInfo Interface
IHttpApplication::GetModuleContextContainer Method
IHttpConnection::GetModuleContextContainer Method
IHttpContext::GetModuleContextContainer Method
IHttpFileMonitor::GetModuleContextContainer Method
IHttpSite::GetModuleContextContainer Method
IHttpUrlInfo::GetModuleContextContainer Method
IMetadataInfo::GetModuleContextContainer Method