This documentation is archived and is not being maintained.

MessageHeaderAttribute.MustUnderstand Property

Specifies whether the node acting in the Actor role must understand this header. This is mapped to the mustUnderstand SOAP header attribute.

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

public bool MustUnderstand { get; set; }

Property Value

Type: System.Boolean
true if the node acting in the Actor role must understand this header; otherwise, false.

For more information, see the Remarks section of MessageHeaderAttribute for details.

Important noteImportant Note:

It is important to remember that if the MustUnderstand property is true in a message being sent and the application on the receiving side does not understand the header a fault is generated. Conversely, if a header with the mustUnderstand SOAP header attribute set to true is received by Windows Communication Foundation (WCF), it must be a part of the message contract (or must be processed by one of the Windows Communication Foundation (WCF) channels); otherwise, it is assumed that the header is not understood and an exception is thrown.

The following code example shows the use of the MessageHeaderAttribute to create a SOAP header for the response message with the Name, Namespace and MustUnderstand properties set to values appropriate for this header. The code example is followed by an example of the message when sent.

 public class HelloResponseMessage
   private string localResponse = String.Empty;
   private string extra = String.Empty;

     Name = "ResponseToGreeting",
     Namespace = "")]
   public string Response
     get { return localResponse; }
     set { localResponse = value; }

     Name = "OutOfBandData",
     Namespace = "",
   public string ExtraValues
     get { return extra; }
     set { this.extra = value; }

   The following is the response message, edited for clarity.

       <a:Action s:mustUnderstand="1">http://HelloResponseMessage/Action</a:Action>
       <h:OutOfBandData s:mustUnderstand="1" xmlns:h="">Served by object 13804354.</h:OutOfBandData>
       <HelloResponseMessage xmlns="Microsoft.WCF.Documentation">
         <ResponseToGreeting xmlns="">Service received: Hello.</ResponseToGreeting>

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0