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 or sets the content type for the next request submitted to the server. Some common content types are:

Content Type Description
text/html The content is text using HTML markup.
text/plain The content is unstructured text in a human readable format. This is the default type for text which does not have another standard subtype.
text/css The content is a cascading style sheet used with HTML documents.
text/csv The content is text using a comma-separated value format.
application/json The content is standard JSON formatted text. This is the standard type for JSON, however some services may use text/x-json.
application/xml The content is standard XML formatted text. This is the standard type for XML, however some servers may use text/xml.
application/pdf The content is is a document using the Portable Document Format (PDF).
application/octet-stream The content contains binary data. This is the default type for binary data which does not have another standard subtype.
image/png The content is an image using the PNG format.
image/jpeg The content is an image using the JPEG format.
image/gif The content is an image using the GIF format.
audio/mpeg The content is audio data using the MP3 format.
video/mp4 The content is video data using the MP4 format.

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 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.

Changing the value of this property will change the content type specified in the request header for the next request made by the client. Typically this is done in conjunction with the PostData method to specify the type of data that is being submitted to the server using a POST command.

Data Type

String

See Also

HeaderField Property, HeaderValue Property, GetHeader Method, PostData Method, SetHeader Method