Gets or sets a value that indicates whether the context management is enabled.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
When context management is enabled the context channel caches the context in its lifetime. Context can be retrieved from the channel through the IContextManager channel property by calling GetContext method on it. The channel can also be pre-initialized with context before being opened by calling the SetContext method on the channel property. Once the channel is initialized with context it cannot be reset.
The following are invariants in this mode:
Any call to SetContext after the channel is open throws an InvalidOperationException.
Any attempt to send context through the ContextMessageProperty in an outgoing message throws InvalidOperationException.
If a message is received from the server with context, when the channel is already initialized with a context a ProtocolException is thrown. Note that you can receive initial context from a server if the channel is opened without explicitly setting the context.
The ContextMessageProperty on an incoming message is always null.
When context management is not enabled, the context channel does not manage context. It is the application's responsibility to retrieve, manage and apply context through the ContextMessageProperty. Any attempt to call GetContext or SetContext using through the IContextManager channel property results in InvalidOperationException.
All HTTP cookies, except for context HTTP cookies, are handled at the channel level. Context HTTP cookies are managed at the application level. This can have unexpected consequences when channels are shared to talk to different instances targeted by ContextMessageProperty. The following table shows how HTTP cookies are affected when is set to either true or false.
Context HTTP Cookie Scope
Other HTTP Cookies Scope
For each message (explicitly managed by application)
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.