runtime: ssl certificate processing logic error
Description
The behavior on core and .NET Framework is inconsistent, and the SSL certificate cannot be handled correctly, resulting in the failure of business code
Reproduction Steps
sample code
using System.Net;
using System.Net.Security;
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
delegate
{
return true;
}
);
var wb = new WebClient();
wb.DownloadFile("https://pubuserqiniu.paperol.cn/181807649_54_q11_1665653480Ytkkdt.docx?attname=55_11_%e6%b0%b4%e5%ba%93%e7%94%9f%e6%80%81%e9%b1%bc%e7%b2%be%e5%87%86%e6%8d%95%e6%8d%9e%e6%97%a0%e6%8a%97%e8%bf%90%e8%be%9310.13.docx&e=1674795131&token=-kY3jr8KMC7l3KkIN3OcIs8Q4s40OfGgUHr1Rg4D:3QdoI-6iu-Bc6ebPLVzbvvQhC64=", "test.docx");
When the above code is executed in all netcore versions, an error will occur and the file cannot be downloaded.(even if i ignore certificate error in ServerCertificateValidationCallback,Of course, this also includes HttpClient).
.net 7.0.200 output

But he works fine on .NET Framework
Expected behavior
Able to download files normally
Actual behavior
not working
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
Note that this is not our server and we have no control over server certificates
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
After some more tries, I found that it works fine on Framework 4.0 (includ in VS).
This is probably not a very common problem (although we have), so feel free to close this issue.
And I don’t really think it will be fixed 😄 .