共用方式為


X509ServiceCertificateAuthentication.TrustedStoreLocation 屬性

定義

取得或設定要在其內容中驗證用戶端憑證鏈結的受信任存放區位置。

public:
 property System::Security::Cryptography::X509Certificates::StoreLocation TrustedStoreLocation { System::Security::Cryptography::X509Certificates::StoreLocation get(); void set(System::Security::Cryptography::X509Certificates::StoreLocation value); };
public System.Security.Cryptography.X509Certificates.StoreLocation TrustedStoreLocation { get; set; }
member this.TrustedStoreLocation : System.Security.Cryptography.X509Certificates.StoreLocation with get, set
Public Property TrustedStoreLocation As StoreLocation

屬性值

受信任的存放區位置。

例外狀況

已嘗試在認證處於唯讀狀態時設定。

範例

下列程式碼將示範如何設定這個屬性。

ClientCredentials creds = new ClientCredentials();

// Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode
    = X509CertificateValidationMode.ChainTrust;
creds.ServiceCertificate.Authentication.TrustedStoreLocation
    = StoreLocation.LocalMachine;
Dim creds As New ClientCredentials()

' Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.ChainTrust
creds.ServiceCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine

這個屬性也可以在組態檔中設定。

備註

這個屬性會指定是否要使用電腦或使用者內容來驗證 X.509 憑證鏈結。

適用於