IHttpStoredContext Interface


Defines context information for stored data.


class IHttpStoredContext  


The following table lists the methods exposed by the IHttpStoredContext class.

Name Description
CleanupStoredContext Cleans up the stored context.

Derived Classes

Name Description
IWebSocketContext Represents context support for bi-directional WebSocket communications over a single TCP socket.


Many IIS 7 classes maintain a private IDispensedHttpModuleContextContainer pointer as a member variable. These classes implement various interfaces, including IHttpApplication, IHttpConnection, IHttpContext, IHttpFileInfo, IHttpSite, IHttpUrlInfo, and IMetadataInfo.

Each of these interfaces defines a GetModuleContextContainer method, which accepts no arguments and returns an IHttpModuleContextContainer pointer. When the various GetModuleContextContainer methods are called, most of these implementers return the private data as an upcast IHttpModuleContextContainer. This allows the interface implementers to expose custom containers while maintaining the lifetime of those containers.

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 IHttpModuleContextContainer::SetModuleContext and IHttpModuleContextContainer::GetModuleContext methods, respectively.

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


While it may be a safe operation to downcast an IHttpModuleContextContainer to an IDispensedHttpModuleContextContainer by using the dynamic_cast operator, you should avoid performing this cast. The IDispensedHttpModuleContextContainer interface adds only one method, ReleaseContainer, to its base interface, and this method should be called only internally.


Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- 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 Technical Preview
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
- IIS Express 7.5, IIS Express 8.0, IIS Express 10.0
Header Httpserv.h

See Also

Web Server Core Interfaces