ProtocolVersion Property

HttpWebResponse.ProtocolVersion Property

Gets the version of the HTTP protocol that is used in the response.

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

public function get ProtocolVersion () : Version

Property Value

Type: System.Version
A Version that contains the HTTP protocol version of the response.


The current instance has been disposed.

The ProtocolVersion property contains the HTTP protocol version number of the response sent by the Internet resource.

This example creates an HttpWebRequest and queries for an HttpWebResponse. The example then checks to see if the server is responding with the same version.

No code example is currently available or this language may not be supported.
Uri* ourUri = new Uri(url);
// Creates an HttpWebRequest for the specified URL.
HttpWebRequest* myHttpWebRequest =
myHttpWebRequest->ProtocolVersion = HttpVersion::Version10;
// Sends the HttpWebRequest and waits for the response.
HttpWebResponse* myHttpWebResponse =
// Ensures that only Http/1.0 responses are accepted.
if (myHttpWebResponse->ProtocolVersion != HttpVersion::Version10)
   Console::WriteLine(S"\nThe server responded with a version other than Http/1.0");
   if (myHttpWebResponse->StatusCode == HttpStatusCode::OK)
      Console::WriteLine(S"\nRequest sent using version Http/1.0. Successfully received response with version HTTP/1.0 ");
// Releases the resources of the response.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

Community Additions

© 2016 Microsoft