This documentation is archived and is not being maintained.

CallContext.SetHeaders Method

Sets the headers that are sent along with the method call.

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

public static void SetHeaders (
	Header[] headers
)
public static void SetHeaders (
	Header[] headers
)
public static function SetHeaders (
	headers : Header[]
)

Parameters

headers

A Header array of the headers that are to be sent along with the method call.

Exception typeCondition

SecurityException

The immediate caller does not have infrastructure permission.

The following example code shows the ease with which a header is put on the logical thread.

public class HelloService : MarshalByRefObject
{
   public string HelloMethod(string name)
   {
      Console.WriteLine("Hello " + name);
      return "Hello " + name;
   }

   [PermissionSet(SecurityAction.LinkDemand)]
   public string HeaderMethod(string name,Header[] arrHeader)
   {
      Console.WriteLine("HeaderMethod " + name);
      //Header Set with the header array passed
      CallContext.SetHeaders(arrHeader);
      return "HeaderMethod " + name;
   }

}

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: