HttpWebRequest.Accept Property
.NET Framework (current version)
Gets or sets the value of the Accept HTTP header.
Assembly: System (in System.dll)
To clear the Accept HTTP header, set the Accept property to null.
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. Dim myHttpWebRequest As 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. Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show:
