Export (0) Print
Expand All

ServicePoint.Certificate Property

Gets the certificate received for this ServicePoint.

[Visual Basic]
Public ReadOnly Property Certificate As X509Certificate
[C#]
public X509Certificate Certificate {get;}
[C++]
public: __property X509Certificate* get_Certificate();
[JScript]
public function get Certificate() : X509Certificate;

Property Value

An instance of the X509Certificate class containing the security certificate received for this ServicePoint.

Remarks

Although a ServicePoint can make multiple connections to an Internet resource, it can maintain only one certificate.

Example

[Visual Basic, C#, C++] The following example displays the value of this property.

[Visual Basic] 
If sp.Certificate Is Nothing Then
    Console.WriteLine("Certificate = (null)")
Else
    Console.WriteLine(("Certificate = " + sp.Certificate.ToString()))
End If

If sp.ClientCertificate Is Nothing Then
    Console.WriteLine("ClientCertificate = (null)")
Else
    Console.WriteLine(("ClientCertificate = " + sp.ClientCertificate.ToString()))
End If

Console.WriteLine("ProtocolVersion = " + sp.ProtocolVersion.ToString())
Console.WriteLine(("SupportsPipelining = " + sp.SupportsPipelining.ToString()))

[C#] 
if (sp.Certificate == null)
    Console.WriteLine ("Certificate = (null)");
else
    Console.WriteLine ("Certificate = " + sp.Certificate.ToString ());

if (sp.ClientCertificate == null)
    Console.WriteLine ("ClientCertificate = (null)");
else
    Console. WriteLine ("ClientCertificate = " + sp.ClientCertificate.ToString ());

Console.WriteLine ("ProtocolVersion = " + sp.ProtocolVersion.ToString ());
Console.WriteLine ("SupportsPipelining = " + sp.SupportsPipelining);


[C++] 
if (sp->Certificate == 0)
    Console::WriteLine(S"Certificate = (null)");
else
    Console::WriteLine(S"Certificate = {0}", sp->Certificate);

if (sp->ClientCertificate == 0)
    Console::WriteLine(S"Client Certificate = (null)");
else
    Console::WriteLine(S"Client Certificate = {0}", sp->ClientCertificate);

Console::WriteLine(S"ProtocolVersion = {0}", sp->ProtocolVersion->ToString());
Console::WriteLine(S"SupportsPipelining = {0}", __box(sp->SupportsPipelining));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

ServicePoint Class | ServicePoint Members | System.Net Namespace

Show:
© 2014 Microsoft