Binding.Protocol 屬性

定義

取得或設定系結將使用的通訊協定。

public:
 property System::String ^ Protocol { System::String ^ get(); void set(System::String ^ value); };
public string Protocol { get; set; }
member this.Protocol : string with get, set
Public Property Protocol As String

屬性值

系結的通訊協定識別碼。

範例

下列範例示範 Protocol 屬性。 如果通訊協定識別碼為 「HTTPs」,則會顯示憑證雜湊和憑證存放區名稱。 此程式碼範例是針對 類別提供的較大範例的 Binding 一部分。

if (binding.Protocol == "https")
{
     // There is a CertificateHash and  
     // CertificateStoreName for the https protocol only.
    bindingdisplay = bindingdisplay + "\n   CertificateHash: " + 
        binding.CertificateHash + ": ";
    // Display the hash.
    foreach (System.Byte certhashbyte in binding.CertificateHash)
    {
        bindingdisplay = bindingdisplay + certhashbyte.ToString() + " ";
    }
    bindingdisplay = bindingdisplay + "\n   CertificateStoreName: " + 
        binding.CertificateStoreName;
}

備註

「HTTP」 值表示使用 HTTP 通訊協定的系結。 值 「HTTPs」 表示使用 HTTP over SSL 的系結。

Protocol屬性值會保留在ApplicationHost.config檔案中。

適用於