Skip to content

ServicePoint retrieved via FindServicePoint does not contain server certificate #24773

@bojanrajkovic

Description

@bojanrajkovic

A typical way to obtain the server certificate after making a request via HttpClient is to use ServicePointManager.FindServicePoint with the URI and grab the Certificate property off of that.

This works fine in .NET 4.5, as evidenced by this fragment from a workbook:

image

However, in a .NET Core application, this doesn't work:

image

You can also see the attached project in certificate-test.zip. It contains a sample you can download and dotnet run.

dotnet --info output:

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.4\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Metadata

Metadata

Assignees

Labels

area-System.Net.HttpdocumentationDocumentation bug or enhancement, does not impact product or test code

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions