HttpRequest.ContentType Property

Definition

Gets or sets the MIME content type of the incoming request.

C#
public string ContentType { get; set; }

Property Value

A string representing the MIME content type of the incoming request, for example, "text/html". Additional common MIME types include "audio.wav", "image/gif", and "application/pdf".

Examples

The following code example assigns the value representing the content type of the incoming request to a string variable.

C#
String str;
 str = Request.ContentType;

The following example shows output that might be produced by this code.

GET

127.0.0.1

127.0.0.1

GET

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1