CallContext::SetHeaders Method (array<Header^>^)
.NET Framework (current version)
Sets the headers that are sent along with the method call.
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition |
|---|---|
| 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 ref class HelloService: public MarshalByRefObject { public: String^ HelloMethod( String^ name ) { Console::WriteLine( "Hello {0}", name ); return "Hello {0}",name; } [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] String^ HeaderMethod( String^ name, array<Header^>^arrHeader ) { Console::WriteLine( "HeaderMethod {0}", name ); //Header Set with the header array passed CallContext::SetHeaders( arrHeader ); return "HeaderMethod {0}",name; } };
SecurityPermission
For operating with infrastructure code. Demand value: SecurityAction::LinkDemand; Permission value: SecurityPermissionFlag::Infrastructure
.NET Framework
Available since 1.1
Available since 1.1
Show: