This documentation is archived and is not being maintained.
HttpWebRequest::Accept Property
Visual Studio 2010
Gets or sets the value of the Accept HTTP header.
Assembly: System (in System.dll)
Property Value
Type: System::StringThe value of the Accept HTTP header. The default value is nullptr.
To clear the Accept HTTP header, set the Accept property to nullptr.
Note |
|---|
The value for this property is stored in WebHeaderCollection. If WebHeaderCollection is set, the property value is lost. |
The following code example sets the Accept property.
// Create a 'HttpWebRequest' object. HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); // Set the 'Accept' property to accept an image of any type. myHttpWebRequest->Accept = "image/*"; // The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() );
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
Note