HttpVersion HttpVersion HttpVersion HttpVersion Class

Definition

Defines the HTTP version numbers that are supported by the HttpWebRequest and HttpWebResponse classes.

public ref class HttpVersion
public class HttpVersion
type HttpVersion = class
Public Class HttpVersion
Inheritance
HttpVersionHttpVersionHttpVersionHttpVersion

Examples

The following example demonstrates the use of HttpVersion.

// Create a 'HttpWebRequest' object.
HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.microsoft.com" ) );
Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol before assignment is : {0}", myHttpWebRequest->ProtocolVersion );
// Assign Version10 to ProtocolVersion.
myHttpWebRequest->ProtocolVersion = HttpVersion::Version10;
// Assign the response Object* of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() );
Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol after  assignment is : {0}", myHttpWebRequest->ProtocolVersion );
Console::WriteLine( "\nThe 'ProtocolVersion' of the response Object* is : {0}", myHttpWebResponse->ProtocolVersion );
// Create a 'HttpWebRequest' object.
HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://www.microsoft.com");
Console.WriteLine("\nThe 'ProtocolVersion' of the protocol before assignment is :{0}",myHttpWebRequest.ProtocolVersion);
// Assign Version10 to ProtocolVersion.
myHttpWebRequest.ProtocolVersion=HttpVersion.Version10;
// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse myHttpWebResponse=(HttpWebResponse)myHttpWebRequest.GetResponse();
Console.WriteLine("\nThe 'ProtocolVersion' of the protocol after  assignment is :{0}",myHttpWebRequest.ProtocolVersion);
Console.WriteLine("\nThe 'ProtocolVersion' of the response object is :{0}",myHttpWebResponse.ProtocolVersion);
' Create a 'HttpWebRequest' object.
Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create("http://www.microsoft.com"), HttpWebRequest)
Console.WriteLine(ControlChars.Cr + "The 'ProtocolVersion' of the protocol before assignment is :{0}", myHttpWebRequest.ProtocolVersion)
' Assign Version10 to ProtocolVersion.
myHttpWebRequest.ProtocolVersion = HttpVersion.Version10
' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable.
Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Console.WriteLine(ControlChars.Cr + "The 'ProtocolVersion' of the protocol after  assignment is :{0}", myHttpWebRequest.ProtocolVersion)
Console.WriteLine(ControlChars.Cr + "The 'ProtocolVersion' of the response object is :{0}", myHttpWebResponse.ProtocolVersion)

Remarks

The HttpVersion class defines the HTTP versions that are supported by the HttpWebRequest and HttpWebResponse classes. The HTTP version number is used to control version-specific features of HTTP, such as pipelining and chunking.

Constructors

HttpVersion() HttpVersion() HttpVersion() HttpVersion()

Initializes a new instance of the HttpVersion class.

Fields

Unknown Unknown Unknown Unknown
Version10 Version10 Version10 Version10

Defines a Version instance for HTTP 1.0.

Version11 Version11 Version11 Version11

Defines a Version instance for HTTP 1.1.

Version20 Version20 Version20 Version20

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to