Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 4.92 KB

File metadata and controls

57 lines (42 loc) · 4.92 KB
title IHttpModuleContextContainer::GetModuleContext Method
description Describes the IHttpModuleContextContainer::GetModuleContext method and details its syntax, parameters, return value, remarks, and requirements.
ms.date 10/07/2016
ms.assetid d0e75a04-da9d-3822-f2dd-5e931ed7a8e7

IHttpModuleContextContainer::GetModuleContext Method

Returns the stored context from the context container.

Syntax

virtual IHttpStoredContext* GetModuleContext(  
   IN HTTP_MODULE_ID moduleId  
) = 0;  

Parameters

moduleId
[IN] An HTTP_MODULE_ID pointer.

Note

HTTP_MODULE_ID is a type definition of a void pointer.

Return Value

A pointer to an IHttpStoredContext; otherwise, NULL.

Remarks

CGlobalModule or CHttpModule pointers register for various events defined in the Httpserv.h header file. For more information, see Request-Processing Constants. Through any of these classes' virtual methods, you can retrieve IHttpModuleContextContainer pointers from various interfaces that implement a GetModuleContextContainer method.

You can define custom classes that implement the IHttpStoredContext interface and then create a pointer to this IHttpStoredContext class implementer by calling the new operator. You can then add and retrieve this pointer on an IHttpModuleContextContainer pointer by calling the SetModuleContext and GetModuleContext methods, respectively.

When the IHttpStoredContext pointer is no longer needed, the IHttpStoredContext::CleanupStoredContext method is called internally, where the implementer of the IHttpStoredContext interface method should usually call delete``this.

Notes for Implementers

IHttpModuleContextContainer implementers are responsible for memory management with this data; therefore, IHttpModuleContextContainer implementers that use dynamic memory allocation must release or call delete on the IHttpStoredContext pointer when it is no longer needed. If cleanup is necessary, you can call the IHttpStoredContext::CleanupStoredContext method.

Notes for Callers

IHttpModuleContextContainer implementers are responsible for memory management with this data; therefore, IHttpModuleContextContainer clients must not release or call delete on the returned IHttpStoredContext pointer when this data is no longer needed.

Example

The following code example demonstrates how to create a global module that listens for GL_TRACE_EVENT events and then calls the GetModuleContext method to retrieve the IHttpStoredContext pointer.

[!code-cppIHttpModuleContextContainer#2]

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

IHttpModuleContextContainer Interface
IHttpModuleContextContainer::SetModuleContext Method