Name
ContentType
Synopsis
String = Response.ContentType Response.ContentType = String
Returns or sets a String containing the MIME type of the current response. This allows you to retrieve or set the value of the HTTP Content-Type response header.
Parameters
-
String A string variable to receive or set the content type. The default is “text/html.”
Example
The following example displays the current MIME content type in the client browser.
Sub Page_Load( )
Message.Text = "Current content type is " & _
Response.ContentType & "<br/>"
End SubNotes
The ContentType property is very important, since it enables you to send content to the client browser other than the default HTML. For example, if you want to use the Response.BinaryWrite method to send binary image data to the client browser, you must also set the ContentType property to the appropriate MIME type (“image/jpg” or “image/gif”, for example). See the BinaryWrite example for an example of how this is done.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access