共用方式為


ServiceCredentials.SecureConversationAuthentication 屬性

定義

取得安全對話要使用的目前設定。

public:
 property System::ServiceModel::Security::SecureConversationServiceCredential ^ SecureConversationAuthentication { System::ServiceModel::Security::SecureConversationServiceCredential ^ get(); };
public System.ServiceModel.Security.SecureConversationServiceCredential SecureConversationAuthentication { get; }
member this.SecureConversationAuthentication : System.ServiceModel.Security.SecureConversationServiceCredential
Public ReadOnly Property SecureConversationAuthentication As SecureConversationServiceCredential

屬性值

SecureConversationServiceCredential 執行個體。

範例

下列程式碼會示範如何使用這個屬性取得服務使用之認證的執行個體。

// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);

// Create a binding that uses a WindowsServiceCredential .
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

// Add an endpoint.
sh.AddServiceEndpoint(typeof(ICalculator), b, "WindowsCalculator");

// Get a reference to the WindowsServiceCredential object.
SecureConversationServiceCredential ssCredential =
    sh.Credentials.SecureConversationAuthentication;
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)

' Create a binding that uses a WindowsServiceCredential .
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows

' Add an endpoint.
sh.AddServiceEndpoint(GetType(ICalculator), b, "WindowsCalculator")

' Get a reference to the WindowsServiceCredential object.
Dim ssCredential As SecureConversationServiceCredential = sh.Credentials.SecureConversationAuthentication

備註

使用此類別指定安全性內容權杖 (SCT) Cookie 序列化的已知宣告型別清單,以及指定可編碼及確保 Cookie 資訊安全的編碼器。

適用於