This documentation is archived and is not being maintained.

HttpWebRequest.MediaType Property

Gets or sets the media type of the request.

[Visual Basic]
Public Property MediaType As String
public string MediaType {get; set;}
public: __property String* get_MediaType();
public: __property void set_MediaType(String*);
public function get MediaType() : String;
public function set MediaType(String);

Property Value

The media type of the request. The default value is a null reference (Nothing in Visual Basic).


The value of the MediaType property affects the CharacterSet property. When you set the MediaType in the request, the corresponding media type is chosen from the list of character sets returned in the response Content-type HTTP header.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

HttpWebRequest Class | HttpWebRequest Members | System.Net Namespace