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.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft