Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ContextId Property

ContextUtil.ContextId Property

Gets a GUID for the current context.

Namespace:  System.EnterpriseServices
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)

public static Guid ContextId { get; }

Property Value

Type: System.Guid
The GUID for the current context.

ExceptionCondition
COMException

There is no COM+ context available.

PlatformNotSupportedException

The platform is not Windows 2000 or later.

The following example code demonstrates the use of this attribute.

protected override void Activate()
{
    MessageBox.Show( String.Format("Now entering...\nApplication: {0}\nInstance: {1}\nContext: {2}\n",
                                   ContextUtil.ApplicationId.ToString(), ContextUtil.ApplicationInstanceId.ToString(),
                                   ContextUtil.ContextId.ToString() ) );
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft