MailSecurityMode 列舉型別
定義是否啟用 SOAP 訊息安全性。
命名空間: Microsoft.ServiceModel.Channels.Mail
組件: Microsoft.ServiceModel.Channels.Mail (在 Microsoft.ServiceModel.Channels.Mail.dll 中)
語法
'宣告
Public Enumeration MailSecurityMode
'用途
Dim instance As MailSecurityMode
public enum MailSecurityMode
public enum class MailSecurityMode
public enum MailSecurityMode
成員
成員名稱 | 說明 | |
---|---|---|
None | SOAP 訊息安全性為停用。這是預設值。 | |
Message | SOAP 訊息安全性為啟用。 |
備註
依預設,郵件繫結會將 SOAP 訊息安全性設為 MailSecurityMode.None,這會停用 SOAP 訊息安全性。
在啟用 SOAP 訊息安全性時,郵件繫結會使用 AsymmetricSecurityBindingElement。用於郵件傳輸的 SOAP 訊息安全性是以 X.509 憑證為基礎。AsymmetricSecurityBindingElement 屬性的預設值如下:
MessageSecurityVersion = MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10
SecurityHeaderLayout = SecurityHeaderLayout.Lax
MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt
IncludeTimestamp = true
SecurityBindingElement.LocalServiceSettings.TimestampValidityDuration = 24 小時。
SecurityBindingElement.LocalClientSettings.TimestampValidityDuration = 24 小時。
若為裝置架構的應用程式,也會使用下列的預設值:
SecurityBindingElement.LocalClientSettings.DetectReplays = false
SecurityBindingElement.LocalServiceSettings.DetectReplays = false
若為桌面應用程式,也會使用下列的預設值:
SecurityBindingElement.LocalClientSettings.ReplayWindow = 24 小時
SecurityBindingElement.LocalServiceSettings.ReplayWindow = 24 小時
System.ServiceModel.Channels.AsymmetricSecurityBindingElement.InitiatorTokenParameters.RequireDerivedKeys = false
System.ServiceModel.Channels.AsymmetricSecurityBindingElement.RecipientTokenParameters.RequireDerivedKeys = false
如果您需要變更預設的 SOAP 訊息安全性,您可以具現化 (Instantiate) 所有繫結的項目,並將它們傳送至 CustomBinding 物件的建構函式 (Constructor),而不是使用衍生自 MailBindingBase 物件的類別。此外,您也可以呼叫 CreateBindingElements 方法,以傳回繫結項目、變更特定繫結項目上的值,然後將繫結的項目傳遞給 CustomBinding 物件。
範例
下列範例顯示如何啟用訊息繫結的訊息安全性。如需完整的程式碼範例,請參閱 MailSecurity 類別。
Dim binding As ExchangeWebServiceMailBinding
Dim clientEmailServer As New Uri("http://mail.example.com")
Dim clientEmailAddress As String = "client@example.com"
Dim password As String = "password"
binding = New ExchangeWebServiceMailBinding(clientEmailServer, New NetworkCredential(clientEmailAddress, password))
binding.Security.Mode = MailSecurityMode.Message
ExchangeWebServiceMailBinding binding;
Uri clientEmailServer = new Uri("http://mail.example.com");
string clientEmailAddress = "client@example.com";
string password = "password";
binding = new ExchangeWebServiceMailBinding(clientEmailServer,
new NetworkCredential(clientEmailAddress, password));
binding.Security.Mode = MailSecurityMode.Message;
平台
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Compact Framework
支援版本:3.5