SmtpClient.TargetName 属性


获取或设置在使用扩展保护时用于身份验证的服务提供程序名称 (SPN)。Gets or sets the Service Provider Name (SPN) to use for authentication when using extended protection.

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


一个 String,它指定用于扩展保护的 SPN。A String that specifies the SPN to use for extended protection. 此 SPN 的默认值的格式为 "SMTPSVC/<host>",其中 <host> 是 SMTP 邮件服务器的主机名。The default value for this SPN is of the form "SMTPSVC/<host>" where <host> is the hostname of the SMTP mail server.


当应用程序使用扩展保护时,TargetName 属性与集成的 Windows 身份验证一起使用。The TargetName property is used with integrated Windows authentication when an application is using extended protection. 然后,SmtpClient 可以提供扩展保护,以确保凭据质询响应包含特定于服务的信息(SPN)以及特定于通道的信息(如通道绑定令牌或 CBT)。The SmtpClient can then provide extended protection to ensure that credential challenge responses contain service specific information (a SPN) and, if necessary, channel specific information (a channel binding token or CBT). 使用凭据交换中的此信息,服务可以更好地防止恶意使用可能未正确获取的凭据质询响应。With this information in the credential exchanges, services are able to better protect against malicious use of credential challenge responses that might have been improperly obtained.

还可以在计算机或应用程序配置文件中设置此属性的默认值。The default value for this property can also be set in a machine or application configuration file. TargetName 属性所做的任何更改都会覆盖配置文件设置。Any changes made to the TargetName property override the configuration file settings.