System.Net.HttpWebRequest.ContentType Property

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


public override string ContentType { get; set; }


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


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.


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


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