Search code examples
c#.netsslavatar

How to fix "The SSL connection could not be established, see inner exception." when trying to download osu! avatar


I want to download osu! avatars to use them, but keep getting this error:

The SSL connection could not be established.

Inner exception is:

System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: Получено непредвиденное сообщение или оно имеет неправильный формат

Example url: https://a.ppy.sh/10638551?1524507784.png

I tried using HttpClient and WebClient but without any success.

using(HttpClient client = new HttpClient())
{
     var resp = await client.GetAsync("https://a.ppy.sh/10638551?1547998515.jpeg");
     var responseStr = await resp.Content.ReadAsStringAsync();
     File.WriteAllText("html/avatars/avatar.jpeg", responseStr);
}

Solution

  • Answer:


    After some time i figured that the library i was using was a bit bad. And after that i discovered Selenium.

    With that in mind i started using Selenium WebDriver and figured that i can take a screenshot of a page i needed, then i cropped that image and i got what i needed.
    So theres no need to continue this issue.