ContentType Property  
 

Set or return the content type for the current resource.

Syntax

object.ContentType [= value]

Remarks

The ContentType property returns content type for the current resource. Changing this value sets the content type for the next request submitted to the server.

This property returns a value based on the Content-Type response header and does not examine the contents of the payload returned by the server. If the web server does not recognize the data format of the resource it is returning, this property should return a value of application/octet-stream. However, some servers incorrectly return unrecognized formats as text/plain, causing the payload to be identified as human-readable text rather than binary data.

Some servers will return a content type of text/plain for JSON responses and others will use the IANA standard type of application/json. If the server returns an XML payload, it may indicate the content type either as text/xml or application/xml.

Data Type

String

See Also

HeaderField Property, HeaderValue Property, GetHeader Method, SetHeader Method