Export (0) Print
Expand All

X509CertificateInitiatorServiceCredential.SetCertificate Method (String, StoreLocation, StoreName)

Enables you to specify the certificate to use for encrypting messages for the client by specifying the subject distinguished name. This setting is used only by bindings that are configured with the MutualCertificateDuplex message security authentication mode.

Namespace: System.ServiceModel.Security
Assembly: System.ServiceModel (in system.servicemodel.dll)

public void SetCertificate (
	string subjectName,
	StoreLocation storeLocation,
	StoreName storeName
)
public void SetCertificate (
	String subjectName, 
	StoreLocation storeLocation, 
	StoreName storeName
)
public function SetCertificate (
	subjectName : String, 
	storeLocation : StoreLocation, 
	storeName : StoreName
)
Not applicable.

Parameters

subjectName

Subject distinguished name.

storeLocation

The location of the certificate store that the service uses to obtain the certificate.

storeName

The name of the X.509 certificate store to open.

For more information about the subjectName parameter, see SubjectName.

Values for storeLocation are included in the StoreLocation enumeration:

  • LocalMachine: the certificate store assigned to the local machine (default).

  • CurrentUser: the certificate store used by the current user.

If the client application is running under a system account, then the certificate is typically in LocalMachine. If the client application is running under a user account, then the certificate is typically in CurrentUser.

Values for storeName are included in the StoreName enumeration.

The following code shows how to use this method to set the certificate.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft