HttpListenerResponse.ContentType Property

Definition

Gets or sets the MIME type of the content returned.

public:
 property System::String ^ ContentType { System::String ^ get(); void set(System::String ^ value); };
public string? ContentType { get; set; }
public string ContentType { get; set; }
member this.ContentType : string with get, set
Public Property ContentType As String

Property Value

A String instance that contains the text of the response's Content-Type header.

Exceptions

The value specified for a set operation is null.

The value specified for a set operation is an empty string ("").

This object is closed.

Remarks

When communicating with a Web browser, you should explicitly set this property when returning any content type other than text/html.

For a complete list of response headers, see the HttpResponseHeader enumeration.

Applies to

See also