Export (0) Print
Expand All

IMethodMessage.LogicalCallContext Property

Gets the LogicalCallContext for the current method call.

Namespace:  System.Runtime.Remoting.Messaging
Assembly:  mscorlib (in mscorlib.dll)

LogicalCallContext LogicalCallContext { get; }

Property Value

Type: System.Runtime.Remoting.Messaging.LogicalCallContext
Gets the LogicalCallContext for the current method call.


The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.

The following example code shows how to use the LogicalCallContext property to determine whether any values are attached to the logical thread.

   public class MyProxy : RealProxy

   String stringUri;
   MarshalByRefObject targetObject;

public MyProxy(Type type) : base(type)
      targetObject = (MarshalByRefObject)Activator.CreateInstance(type);
      ObjRef myObject = RemotingServices.Marshal(targetObject);
      stringUri = myObject.URI;

   public MyProxy(Type type, MarshalByRefObject targetObject) : base(type)
      this.targetObject = targetObject;

[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)]
   public override IMessage Invoke(IMessage message)
      message.Properties["__Uri"] = stringUri;
      IMethodMessage myMethodMessage = 

      Console.WriteLine("---------IMethodMessage example-------");
      Console.WriteLine("Method name : " + myMethodMessage.MethodName);
      Console.WriteLine("LogicalCallContext has information : " +
      Console.WriteLine("Uri : " + myMethodMessage.Uri);

      return myMethodMessage;

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, 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.

Community Additions

© 2015 Microsoft