Share via


ContentType Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

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

Syntax

'Declaration
Public Overrides Property ContentType As String
public override string ContentType { get; set; }
public:
virtual property String^ ContentType {
    String^ get () override;
    void set (String^ value) override;
}
abstract ContentType : string with get, set
override ContentType : string with get, set
override function get ContentType () : String
override function set ContentType (value : String)

Property Value

Type: System. . :: . .String
The value of the Content-type HTTP header. The default value is nullNothingnullptrunita null reference (Nothing in Visual Basic).

Remarks

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 Nothing nullptr unit a null reference (Nothing in Visual Basic) .

.NET Framework Security

See Also

Reference

HttpWebRequest Class

System.Net Namespace