Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ignoring localhost certificate validation errors #2543

Merged
merged 4 commits into from
Oct 7, 2024

Conversation

simonrozsival
Copy link
Member

@simonrozsival simonrozsival commented Oct 4, 2024

I noticed our docs recommend quite a complicated setup to ignore localhost certificate validation errors. Thanks to the work we did in recent .NET releases, all platform handlers now support ServerCertificateCustomValidationCallback and they can be used via the HttpClientHandler class in a cross-platform way.


Associated WorkItem - 320966

@davidbritch davidbritch self-requested a review October 4, 2024 13:55
@davidbritch davidbritch added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Oct 4, 2024
@davidbritch davidbritch self-assigned this Oct 4, 2024
@sequestor sequestor bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Oct 4, 2024
@davidbritch
Copy link
Contributor

@simonrozsival Are the changes .NET 8 compatible?

@simonrozsival
Copy link
Member Author

@davidbritch Yes, this works with .NET 8.

@davidbritch
Copy link
Contributor

This has come back to me. The Xamarin.Forms version of this doc was a lot simpler (https://learn.microsoft.com/en-gb/previous-versions/xamarin/cross-platform/deploy-test/connect-to-local-web-services#bypass-the-certificate-security-check) but it wasn't so easy in .NET MAUI 6.

@simonrozsival
Copy link
Member Author

Yes, we didn't have any support for ServerCertificateCustomValidationCallback in .NET 6 and limited in .NET 7 (SocketsHttpHandler didn't support it on Android). Starting in .NET 8, it is supported on both iOS and Android.

@davidbritch
Copy link
Contributor

Updated the sample: dotnet/maui-samples#525

Copy link
Contributor

@davidbritch davidbritch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@davidbritch davidbritch merged commit 986b137 into dotnet:main Oct 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants