HttpListenerResponse.ContentType 属性

定义

获取或设置返回内容的 MIME 类型。

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

属性值

String 实例,包含响应的 Content-Type 标头文本。

例外

为集运算指定的值为 null

为设置操作指定的值为空字符串 ("")。

此对象已关闭。

注解

与 Web 浏览器通信时,在返回除 text/html之外的任何内容类型时,应显式设置此属性。

有关响应标头的完整列表,请参阅 HttpResponseHeader 枚举。

适用于

另请参阅