Guest User

Untitled

a guest
May 3rd, 2022
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. // www.google.com resolves to 142.250.65.206
  2. // but not to 8.8.8.8
  3. var httpClient = new HttpClient();
  4. var requestUri = new Uri("https://8.8.8.8/");
  5. var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
  6. request.Headers.TryAddWithoutValidation("host", "www.google.com");
  7. var response = await httpClient.SendAsync(request);
  8.  
  9. // This produces WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
  10.  
Advertisement
Add Comment
Please, Sign In to add comment