This documentation is archived and is not being maintained.

SoapMessage.ContentType Property

Gets or sets the HTTP Content-Type of the SOAP request or SOAP response.

[Visual Basic]
Public Property ContentType As String
[C#]
public string ContentType {get; set;}
[C++]
public: __property String* get_ContentType();
public: __property void set_ContentType(String*);
[JScript]
public function get ContentType() : String;
public function set ContentType(String);

Property Value

The HTTP Content-Type of the SOAP request or SOAP response. The default is "text/xml".

Exceptions

Exception Type Condition
InvalidOperationException ContentType is accessed AfterSerialize or AfterDeserialize stages.

Remarks

The ContentType property can only be accessed in the BeforeSerialize and BeforeDeserialize stages; otherwise, an InvalidOperationException is thrown.

Use the ContentEncoding property, instead of the ContentType property to provide supplementary information about the encoding of a SOAP message.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

SoapMessage Class | SoapMessage Members | System.Web.Services.Protocols Namespace | SoapMessageStage | ContentEncoding

Show: