HttpWebRequest.ContentType Property

 

Gets or sets the value of the Content-type HTTP header.

Namespace:   System.Net
Assembly:  System (in System.dll)

override ContentType : string with get, set

Property Value

Type: System.String

The value of the Content-type HTTP header. The default value is null.

The ContentType property contains the media type of the request. Values assigned to the ContentType property replace any existing contents when the request sends the Content-type HTTP header.

To clear the Content-type HTTP header, set the ContentType property to null.

System_CAPS_noteNote

The value for this property is stored in WebHeaderCollection . If WebHeaderCollection is set, the property value is lost.

The following code example sets the ContentType property.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: