Retrieves the HTTP context for trace events that are request specific.
A pointer to the address of an IHttpContext interface; otherwise, NULL.
An HRESULT. Possible values include, but are not limited to, those in the following table.
Indicates that the operation was successful.
Indicates that the method is not supported.
CGlobalModule derived classes that register for GL_TRACE_EVENT event types receive an IGlobalTraceEventProvider pointer as a parameter on the CGlobalModule::OnGlobalTraceEvent pure virtual method. You can then retrieve an IHttpContext pointer by calling the GetCurrentHttpRequestContext method on that IGlobalTraceEventProvider pointer.
One possible use for GetCurrentHttpRequestContext is to provide custom buffering of events.
GetCurrentHttpRequestContext behavior depends on implementation. You should use the following information as a guideline, but it may not be correct in all scenarios:
Classes that provide HTTP trace events declare a private IHttpContext pointer member variable. This variable is initialized during construction to a valid IHttpContext pointer. When you call GetCurrentHttpRequestContext, the dereferenced ppHttpContext parameter is set to this variable, and S_OK is returned.
Classes that provide global trace events do not modify the ppHttpContext parameter and return ERROR_NOT_SUPPORTED immediately.
IGlobalTraceEventProvider implementers are responsible for memory management with this data; therefore, IGlobalTraceEventProvider implementers that use dynamic memory allocation must release or call delete on the IHttpContext pointer when it is no longer needed.
IGlobalTraceEventProvider implementers are responsible for memory management with this data; therefore, IGlobalTraceEventProvider clients must not release or call delete on the returned IHttpContext pointer when this data is no longer needed.
The following code example demonstrates how to create a global module that listens for GL_TRACE_EVENT events and declares and initializes an HTTP_TRACE_CONFIGURATION structure that filters for events. The module then retrieves the IHttpContext pointer by calling the GetCurrentHttpRequestContext method.