HttpVersion HttpVersion HttpVersion HttpVersion Class

Definizione

Definisce i numeri di versione HTTP supportati dalle classi HttpWebRequest e HttpWebResponse.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
Ereditarietà
HttpVersionHttpVersionHttpVersionHttpVersion

Esempi

L'esempio seguente illustra l'uso di HttpVersion.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)

Commenti

La HttpVersion classe definisce le versioni http supportate HttpWebRequest dalle classi e HttpWebResponse .The HttpVersion class defines the HTTP versions that are supported by the HttpWebRequest and HttpWebResponse classes. Il numero di versione HTTP viene usato per controllare le funzionalità specifiche della versione di HTTP, ad esempio il pipelining e la suddivisione in blocchi.The HTTP version number is used to control version-specific features of HTTP, such as pipelining and chunking.

Costruttori

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

Inizializza una nuova istanza della classe HttpVersion.Initializes a new instance of the HttpVersion class.

Campi

Unknown Unknown Unknown Unknown
Version10 Version10 Version10 Version10

Definisce un'istanza di Version per HTTP 1.0.Defines a Version instance for HTTP 1.0.

Version11 Version11 Version11 Version11

Definisce un'istanza di Version per HTTP 1.1.Defines a Version instance for HTTP 1.1.

Version20 Version20 Version20 Version20

Metodi

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

Determina se l'oggetto specificato è uguale all'oggetto corrente.Determines whether the specified object is equal to the current object.

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

Funge da funzione hash predefinita.Serves as the default hash function.

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

Ottiene l'oggetto Type dell'istanza corrente.Gets the Type of the current instance.

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

Crea una copia superficiale dell'oggetto Object corrente.Creates a shallow copy of the current Object.

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

Restituisce una stringa che rappresenta l'oggetto corrente.Returns a string that represents the current object.

(Inherited from Object)

Si applica a