共用方式為


ServicePoint.ProtocolVersion 屬性

定義

取得 ServicePoint 物件所使用的 HTTP 通訊協定版本。

public:
 virtual property Version ^ ProtocolVersion { Version ^ get(); };
public virtual Version ProtocolVersion { get; }
member this.ProtocolVersion : Version
Public Overridable ReadOnly Property ProtocolVersion As Version

屬性值

Version 物件,其中包含 ServicePoint 物件所使用的 HTTP 通訊協定版本。

範例

下列程式代碼範例會顯示這個屬性的值。

if ( sp->Certificate == nullptr )
   Console::WriteLine( "Certificate = (null)" );
else
   Console::WriteLine( "Certificate = {0}", sp->Certificate );

if ( sp->ClientCertificate == nullptr )
   Console::WriteLine( "Client Certificate = (null)" );
else
   Console::WriteLine( "Client Certificate = {0}", sp->ClientCertificate );

Console::WriteLine( "ProtocolVersion = {0}", sp->ProtocolVersion->ToString() );
Console::WriteLine( "SupportsPipelining = {0}", sp->SupportsPipelining );
if (sp.Certificate == null)
    Console.WriteLine("Certificate = (null)");
else
    Console.WriteLine("Certificate = " + sp.Certificate.ToString());

if (sp.ClientCertificate == null)
    Console.WriteLine("ClientCertificate = (null)");
else
    Console. WriteLine("ClientCertificate = " + sp.ClientCertificate.ToString());

Console.WriteLine("ProtocolVersion = " + sp.ProtocolVersion.ToString());
Console.WriteLine("SupportsPipelining = " + sp.SupportsPipelining);
If sp.Certificate Is Nothing Then
    Console.WriteLine("Certificate = (null)")
Else
    Console.WriteLine(("Certificate = " + sp.Certificate.ToString()))
End If

If sp.ClientCertificate Is Nothing Then
    Console.WriteLine("ClientCertificate = (null)")
Else
    Console.WriteLine(("ClientCertificate = " + sp.ClientCertificate.ToString()))
End If

Console.WriteLine("ProtocolVersion = " + sp.ProtocolVersion.ToString())
Console.WriteLine(("SupportsPipelining = " + sp.SupportsPipelining.ToString()))

備註

謹慎

WebRequestHttpWebRequestServicePointWebClient 已經過時,您不應該將它們用於新的開發。 請改用 HttpClient

HTTP 通訊協定版本為 HTTP/1.0 和 HTTP/1.1。

適用於