System.Net.HttpWebRequest.ContentType Property

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

Syntax

public override string ContentType { get; set; }

Value

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

Remarks

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

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

Note:

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

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0